From a23de13af90053257778dd0121da627526617852 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Wed, 18 Nov 2020 14:41:47 -0500 Subject: [PATCH] Break up Dockerfile into (additional) test and build images --- docker/Dockerfile.build | 39 +++++++++++++++++++++++++++++++++++++++ docker/Dockerfile.test | 22 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 docker/Dockerfile.build create mode 100644 docker/Dockerfile.test diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build new file mode 100644 index 000000000..9b99a23d8 --- /dev/null +++ b/docker/Dockerfile.build @@ -0,0 +1,39 @@ +# Builder image +FROM rust:buster as builder + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + make cmake g++ gcc llvm libclang-dev + +RUN mkdir /zebra +WORKDIR /zebra + +ENV RUST_BACKTRACE 1 +ENV CARGO_HOME /zebra/.cargo/ +RUN rustc -V; cargo -V; rustup -V + +COPY . . +RUN cargo build --release + + +# Runner image +FROM debian:buster-slim AS zebrad-release + +COPY --from=builder /zebra/target/release/zebrad / + +ARG CHECKPOINT_SYNC=true +ARG NETWORK=Mainnet + +RUN printf "[consensus]\n" >> /zebrad.toml +RUN printf "checkpoint_sync = ${CHECKPOINT_SYNC}\n" >> /zebrad.toml +RUN printf "[network]\n" >> /zebrad.toml +RUN printf "network = '${NETWORK}'\n" >> /zebrad.toml +RUN printf "[state]\n" >> /zebrad.toml +RUN printf "cache_dir = '/zebrad-cache'\n" >> /zebrad.toml +RUN printf "memory_cache_bytes = 52428800\n" >> /zebrad.toml +RUN printf "[tracing]\n" >> /zebrad.toml +RUN printf "endpoint_addr = '0.0.0.0:3000'\n" >> /zebrad.toml + +EXPOSE 3000 8233 18233 + +CMD [ "/zebrad", "-c", "/zebrad.toml", "start" ] diff --git a/docker/Dockerfile.test b/docker/Dockerfile.test new file mode 100644 index 000000000..b41c8c8b8 --- /dev/null +++ b/docker/Dockerfile.test @@ -0,0 +1,22 @@ +FROM rustlang/rust:nightly + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + make cmake g++ gcc llvm libclang-dev + +RUN mkdir /zebra +WORKDIR /zebra + +ENV RUST_BACKTRACE 1 +ENV CARGO_HOME /zebra/.cargo/ + +RUN rustc -V; cargo -V; rustup -V + +EXPOSE 8233 18233 + +COPY . . +RUN cargo test --all --no-run +RUN find /zebra/target/debug/deps -type f -perm 755 ! -name '*.dylib' ! -name '*.so' | sed -e 'p;s/-.*//' | xargs -n2 mv + +# Filtering to only run integration tests requires nightly for now +CMD ["cargo", "+nightly", "test", "--test", "'*'", "--no-fail-fast", "--", "-Zunstable-options", "--include-ignored"]