refactor(build): use FHS for deployments and artifacts (#4786)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Gustavo Valverde 2022-08-03 19:43:32 -04:00 committed by GitHub
parent 42f6c27c98
commit 6ff0a42318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -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
@ -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 && \
@ -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)
#
@ -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 && \

View File

@ -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
@ -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

View File

@ -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 && \
@ -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