Skip to content

Commit

Permalink
refactor(build): use FHS for deployments and artifacts (#4786)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
gustavovalverde and mergify[bot] authored Aug 3, 2022
1 parent 42f6c27 commit 6ff0a42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# This stage implements cargo-chef for docker layer caching
FROM rust:bullseye as chef
RUN cargo install cargo-chef --locked
WORKDIR /app
WORKDIR /opt/zebrad

# Analyze the current project to determine the minimum subset of files
# (Cargo.lock and Cargo.toml manifests) required to build it and cache dependencies
Expand All @@ -25,7 +25,7 @@ RUN cargo chef prepare --recipe-path recipe.json
# We set defaults for the arguments, in case the build does not include this information.
FROM chef AS deps
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
COPY --from=planner /app/recipe.json recipe.json
COPY --from=planner /opt/zebrad/recipe.json recipe.json

# Install zebra build deps
RUN apt-get -qq update && \
Expand Down Expand Up @@ -82,7 +82,7 @@ ENV CHECKPOINT_SYNC ${CHECKPOINT_SYNC:-true}
ARG NETWORK
ENV NETWORK ${NETWORK:-Mainnet}

ENV CARGO_HOME /app/.cargo/
ENV CARGO_HOME /opt/zebrad/.cargo/

# In this stage we build tests (without running then)
#
Expand Down Expand Up @@ -129,7 +129,7 @@ RUN cargo build --locked --release --features sentry --package zebrad --bin zebr
# To save space, this step starts from scratch using debian, and only adds the resulting
# binary from the `release` stage, and the Zcash Sprout & Sapling parameters from ZCash
FROM debian:bullseye-slim AS runtime
COPY --from=release /app/target/release/zebrad /usr/local/bin
COPY --from=release /opt/zebrad/target/release/zebrad /usr/local/bin
COPY --from=us-docker.pkg.dev/zealous-zebra/zebra/zcash-params /root/.zcash-params /root/.zcash-params

RUN apt-get update && \
Expand Down
4 changes: 2 additions & 2 deletions docker/zcash-lightwalletd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN go mod download
COPY . ./

# Build and install the binary.
RUN go build -v -o /lightwalletd
RUN go build -v -o /opt/lightwalletd

ARG ZCASHD_CONF_PATH

Expand All @@ -51,7 +51,7 @@ ARG LWD_HTTP_PORT

WORKDIR /

COPY --from=build /lightwalletd /usr/local/bin
COPY --from=build /opt/lightwalletd /usr/local/bin
COPY --from=build $ZCASHD_CONF_PATH ./

EXPOSE 9067
Expand Down
6 changes: 3 additions & 3 deletions docker/zcash-params/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This image is for caching Zcash Sprout and Sapling parameters
FROM rust:bullseye as chef
RUN cargo install cargo-chef --locked
WORKDIR /app
WORKDIR /opt/zebrad

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS release
COPY --from=planner /app/recipe.json recipe.json
COPY --from=planner /opt/zebrad/recipe.json recipe.json

# Install zebra build deps
RUN apt-get -qq update && \
Expand All @@ -21,7 +21,7 @@ RUN apt-get -qq update && \
; \
rm -rf /var/lib/apt/lists/* /tmp/*

ENV CARGO_HOME /app/.cargo/
ENV CARGO_HOME /opt/zebrad/.cargo/
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --features sentry --package zebrad --recipe-path recipe.json

Expand Down

0 comments on commit 6ff0a42

Please sign in to comment.