From 6c889fa3e39bf05fcfb4674f579371b936aaeb76 Mon Sep 17 00:00:00 2001 From: SeongChan Lee Date: Thu, 6 Sep 2018 02:55:29 +0900 Subject: [PATCH] Build a Docker image using multi-stage builds --- .dockerignore | 2 ++ docker/ubuntu/Dockerfile | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index d5c4ed13e9..98fc308af1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ /.git/ +/.idea/ /target/ /keys/ /db/ +/docker/ \ No newline at end of file diff --git a/docker/ubuntu/Dockerfile b/docker/ubuntu/Dockerfile index 47353f88be..5287a0d4c1 100644 --- a/docker/ubuntu/Dockerfile +++ b/docker/ubuntu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:14.04 as builder WORKDIR /build # install tools and dependencies @@ -38,8 +38,14 @@ RUN cd codechain && \ RUN file /build/codechain/target/release/codechain -WORKDIR /build/codechain -EXPOSE 3485 8080 -ENTRYPOINT ["target/release/codechain"] +FROM ubuntu:14.04 +WORKDIR /app/codechain +COPY --from=builder /build/codechain/target/release/codechain ./target/release/codechain +COPY --from=builder /build/codechain/codechain/config/presets/ ./codechain/config/presets +# show backtraces +ENV RUST_BACKTRACE 1 + +EXPOSE 3485 8080 +ENTRYPOINT ["target/release/codechain"] \ No newline at end of file