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:
parent
42f6c27c98
commit
6ff0a42318
|
|
@ -9,7 +9,7 @@
|
||||||
# This stage implements cargo-chef for docker layer caching
|
# This stage implements cargo-chef for docker layer caching
|
||||||
FROM rust:bullseye as chef
|
FROM rust:bullseye as chef
|
||||||
RUN cargo install cargo-chef --locked
|
RUN cargo install cargo-chef --locked
|
||||||
WORKDIR /app
|
WORKDIR /opt/zebrad
|
||||||
|
|
||||||
# Analyze the current project to determine the minimum subset of files
|
# Analyze the current project to determine the minimum subset of files
|
||||||
# (Cargo.lock and Cargo.toml manifests) required to build it and cache dependencies
|
# (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.
|
# We set defaults for the arguments, in case the build does not include this information.
|
||||||
FROM chef AS deps
|
FROM chef AS deps
|
||||||
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
|
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
|
# Install zebra build deps
|
||||||
RUN apt-get -qq update && \
|
RUN apt-get -qq update && \
|
||||||
|
|
@ -82,7 +82,7 @@ ENV CHECKPOINT_SYNC ${CHECKPOINT_SYNC:-true}
|
||||||
ARG NETWORK
|
ARG NETWORK
|
||||||
ENV NETWORK ${NETWORK:-Mainnet}
|
ENV NETWORK ${NETWORK:-Mainnet}
|
||||||
|
|
||||||
ENV CARGO_HOME /app/.cargo/
|
ENV CARGO_HOME /opt/zebrad/.cargo/
|
||||||
|
|
||||||
# In this stage we build tests (without running then)
|
# 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
|
# 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
|
# binary from the `release` stage, and the Zcash Sprout & Sapling parameters from ZCash
|
||||||
FROM debian:bullseye-slim AS runtime
|
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
|
COPY --from=us-docker.pkg.dev/zealous-zebra/zebra/zcash-params /root/.zcash-params /root/.zcash-params
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ RUN go mod download
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
# Build and install the binary.
|
# Build and install the binary.
|
||||||
RUN go build -v -o /lightwalletd
|
RUN go build -v -o /opt/lightwalletd
|
||||||
|
|
||||||
ARG ZCASHD_CONF_PATH
|
ARG ZCASHD_CONF_PATH
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ ARG LWD_HTTP_PORT
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
COPY --from=build /lightwalletd /usr/local/bin
|
COPY --from=build /opt/lightwalletd /usr/local/bin
|
||||||
COPY --from=build $ZCASHD_CONF_PATH ./
|
COPY --from=build $ZCASHD_CONF_PATH ./
|
||||||
|
|
||||||
EXPOSE 9067
|
EXPOSE 9067
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
# This image is for caching Zcash Sprout and Sapling parameters
|
# This image is for caching Zcash Sprout and Sapling parameters
|
||||||
FROM rust:bullseye as chef
|
FROM rust:bullseye as chef
|
||||||
RUN cargo install cargo-chef --locked
|
RUN cargo install cargo-chef --locked
|
||||||
WORKDIR /app
|
WORKDIR /opt/zebrad
|
||||||
|
|
||||||
FROM chef AS planner
|
FROM chef AS planner
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
FROM chef AS release
|
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
|
# Install zebra build deps
|
||||||
RUN apt-get -qq update && \
|
RUN apt-get -qq update && \
|
||||||
|
|
@ -21,7 +21,7 @@ RUN apt-get -qq update && \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/*
|
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!
|
# Build dependencies - this is the caching Docker layer!
|
||||||
RUN cargo chef cook --release --features sentry --package zebrad --recipe-path recipe.json
|
RUN cargo chef cook --release --features sentry --package zebrad --recipe-path recipe.json
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue