-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use multi-stage docker build to reduce image size.
- Loading branch information
Showing
2 changed files
with
30 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
FROM ubuntu:eoan | ||
# | ||
# First stage - builder | ||
# | ||
FROM debian:10-slim AS builder | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LC_ALL C.UTF-8 | ||
|
||
# This allows you to use a local Ubuntu mirror | ||
ARG APT_URL= | ||
ENV APT_URL ${APT_URL:-http://archive.ubuntu.com/ubuntu/} | ||
RUN sed -i "s%http://archive.ubuntu.com/ubuntu/%${APT_URL}%" /etc/apt/sources.list | ||
|
||
# This allows you to use a local Debian mirror | ||
ARG APT_URL=http://deb.debian.org/debian/ | ||
ARG MAKE_FLAGS=-j2 | ||
|
||
# Update packages and install dependencies | ||
RUN apt-get update && apt-get -y upgrade && apt-get -y clean | ||
RUN apt-get install -y protobuf-compiler libh2o-dev libcurl4-openssl-dev \ | ||
libssl-dev libprotobuf-dev libh2o-evloop-dev libwslay-dev libeigen3-dev libzstd-dev \ | ||
make gcc g++ git build-essential curl autoconf automake libfmt-dev libncurses5-dev \ | ||
&& apt-get -y clean | ||
RUN sed -i "s%http://deb.debian.org/debian/%${APT_URL}%" /etc/apt/sources.list \ | ||
&& apt-get update && apt-get -y upgrade \ | ||
&& apt-get install -y protobuf-compiler libh2o-dev libcurl4-openssl-dev \ | ||
libssl-dev libprotobuf-dev libh2o-evloop-dev libwslay-dev \ | ||
libeigen3-dev libzstd-dev libfmt-dev libncurses-dev \ | ||
make gcc g++ git build-essential curl autoconf automake help2man | ||
|
||
# Build | ||
ARG MAKE_FLAGS=-j2 | ||
ADD . /galmon/ | ||
WORKDIR /galmon/ | ||
RUN make $MAKE_FLAGS | ||
ENV PATH=/galmon:${PATH} | ||
ADD . /galmon-src/ | ||
RUN cd /galmon-src/ \ | ||
&& make $MAKE_FLAGS \ | ||
&& prefix=/galmon make install | ||
|
||
# | ||
# Second stage - contains just the binaries | ||
# | ||
FROM debian:10-slim | ||
RUN apt-get update && apt-get -y upgrade \ | ||
&& apt-get install -y libcurl4 libssl1.1 libprotobuf17 libh2o-evloop0.13 \ | ||
libncurses6 \ | ||
&& apt-get -y clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /galmon/ /galmon/ | ||
ENV PATH=/galmon/bin:${PATH} | ||
ENV LC_ALL C.UTF-8 | ||
WORKDIR /galmon/bin |
This file was deleted.
Oops, something went wrong.