Skip to content

Build a Docker image using multi-stage builds #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/.git/
/.idea/
/target/
/keys/
/db/
/docker/
14 changes: 10 additions & 4 deletions docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:14.04
FROM ubuntu:14.04 as builder
WORKDIR /build

# install tools and dependencies
Expand Down Expand Up @@ -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"]