-
Notifications
You must be signed in to change notification settings - Fork 11
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 builds for docker image (#434)
Previously we used a bunch of dockerfiles to coordinate building the cernan docker image. The future rolled up on us meanwhile and we can now make use of multi-stage builds in Docker. Signed-off-by: Brian L. Troutwine <blt@postmates.com>
- Loading branch information
Showing
8 changed files
with
52 additions
and
95 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM ekidd/rust-musl-builder:1.24.0 as builder | ||
|
||
RUN VERS=1.2.11 && \ | ||
cd /home/rust/libs && \ | ||
curl -LO http://zlib.net/zlib-$VERS.tar.gz && \ | ||
tar xzf zlib-$VERS.tar.gz && cd zlib-$VERS && \ | ||
CC=musl-gcc CFLAGS=-fPIC ./configure --static --prefix=/usr/local/musl && \ | ||
make && sudo make install && \ | ||
cd .. && rm -rf zlib-$VERS.tar.gz zlib-$VERS | ||
|
||
RUN cd /home/rust/libs && \ | ||
curl -LO https://github.com/lz4/lz4/archive/master.tar.gz && \ | ||
tar xfz master.tar.gz && \ | ||
ls && \ | ||
cd lz4-master && \ | ||
CC=musl-gcc CFLAGS=-fPIC make prefix=/usr/local/musl && \ | ||
sudo make install prefix=/usr/local/musl && \ | ||
cd .. && \ | ||
rm -rf master.tar.gz lz4-master | ||
|
||
RUN sudo apt-get update && \ | ||
sudo apt-get install -y python2.7-minimal && \ | ||
sudo ln -sf /usr/bin/python2.7 /usr/bin/python | ||
|
||
ENV CC=musl-gcc \ | ||
CFLAGS=-I/usr/local/musl/include \ | ||
LDFLAGS=-L/usr/local/musl/lib | ||
|
||
COPY --chown=rust:rust . /source | ||
RUN cd /source && cargo build --release | ||
|
||
FROM alpine:3.7 | ||
|
||
RUN apk update \ | ||
&& apk upgrade --no-cache | ||
|
||
RUN apk add --no-cache --update \ | ||
ca-certificates \ | ||
llvm-libunwind \ | ||
openssl && \ | ||
update-ca-certificates && \ | ||
rm -rf /var/cache/apk/* && \ | ||
mkdir -p /etc/cernan/scripts | ||
|
||
COPY --from=builder /source/target/x86_64-unknown-linux-musl/release/cernan /usr/bin/cernan | ||
COPY examples/configs/quickstart.toml /etc/cernan/cernan.toml | ||
|
||
ENV STATSD_PORT 8125 | ||
|
||
ENTRYPOINT /usr/bin/cernan | ||
CMD ["--config", "/etc/cernan/cernan.toml"] |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.