turn incremental builds back on
This commit is contained in:
parent
d14837aa77
commit
e5f3200d1a
102
Dockerfile
102
Dockerfile
@ -1,8 +1,8 @@
|
|||||||
FROM debian:bullseye-slim as rust
|
FROM debian:bullseye-slim as rust
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# Incrementally compiled crates cannot be cached with sccache
|
# sccache cannot cache incrementals, but we use --mount=type=cache and import caches so it should be helpful
|
||||||
ENV CARGO_INCREMENTAL false
|
ENV CARGO_INCREMENTAL true
|
||||||
ENV CARGO_UNSTABLE_SPARSE_REGISTRY true
|
ENV CARGO_UNSTABLE_SPARSE_REGISTRY true
|
||||||
ENV CARGO_TERM_COLOR always
|
ENV CARGO_TERM_COLOR always
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-c" ]
|
||||||
@ -56,88 +56,27 @@ RUN --mount=type=cache,target=/root/.cargo/git \
|
|||||||
bash /tmp/install-binstall.sh; \
|
bash /tmp/install-binstall.sh; \
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
|
|
||||||
# sccache
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS=4
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
set -eux -o pipefail; \
|
|
||||||
\
|
|
||||||
cargo binstall -y sccache; \
|
|
||||||
sccache -s
|
|
||||||
|
|
||||||
ENV RUSTC_WRAPPER "/root/.cargo/bin/sccache"
|
|
||||||
|
|
||||||
# nextest runs tests in parallel (done its in own FROM so that it can run in parallel)
|
# nextest runs tests in parallel (done its in own FROM so that it can run in parallel)
|
||||||
# TODO: i'd like to use binaries for these, but i had trouble with arm and binstall
|
# TODO: i'd like to use binaries for these, but i had trouble with arm and binstall
|
||||||
FROM rust as rust_nextest
|
FROM rust as rust_nextest
|
||||||
|
|
||||||
# keep the ARGs from the previous step
|
|
||||||
# we probably won't need sccache since we install with binstall. But compiling is a fallback for binstall, so it is possible.
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
set -eux -o pipefail; \
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
sccache -s; \
|
cargo binstall -y cargo-nextest
|
||||||
cargo binstall -y cargo-nextest; \
|
|
||||||
sccache -s
|
|
||||||
|
|
||||||
# foundry/anvil are needed to run tests (done its in own FROM so that it can run in parallel)
|
# foundry/anvil are needed to run tests (done its in own FROM so that it can run in parallel)
|
||||||
FROM rust as rust_foundry
|
FROM rust as rust_foundry
|
||||||
|
|
||||||
# keep the ARGs from the previous step
|
|
||||||
# we probably won't need sccache since foundry tries to use binaries. But compiling is a fallback, so it is possible.
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
set -eux -o pipefail; \
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
sccache -s; \
|
curl -L https://foundry.paradigm.xyz | bash && foundryup
|
||||||
curl -L https://foundry.paradigm.xyz | bash && foundryup; \
|
|
||||||
sccache -s
|
|
||||||
|
|
||||||
FROM rust as rust_with_env
|
FROM rust as rust_with_env
|
||||||
|
|
||||||
# keep the ARGs from the previous step
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
|
|
||||||
# changing our features doesn't change any of the steps above
|
# changing our features doesn't change any of the steps above
|
||||||
ENV WEB3_PROXY_FEATURES "deadlock_detection,rdkafka-src"
|
ENV WEB3_PROXY_FEATURES "deadlock_detection,rdkafka-src"
|
||||||
|
|
||||||
@ -147,7 +86,6 @@ COPY . .
|
|||||||
# fetch deps
|
# fetch deps
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
--mount=type=cache,target=/app/target \
|
--mount=type=cache,target=/app/target \
|
||||||
set -eux -o pipefail; \
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
@ -160,65 +98,34 @@ FROM rust_with_env as build_tests
|
|||||||
COPY --from=rust_foundry /root/.foundry/bin/anvil /root/.foundry/bin/
|
COPY --from=rust_foundry /root/.foundry/bin/anvil /root/.foundry/bin/
|
||||||
COPY --from=rust_nextest /root/.cargo/bin/cargo-nextest* /root/.cargo/bin/
|
COPY --from=rust_nextest /root/.cargo/bin/cargo-nextest* /root/.cargo/bin/
|
||||||
|
|
||||||
# keep the ARGs from the previous step
|
|
||||||
# sccache should be a huge savings here
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
|
|
||||||
# test the application with cargo-nextest
|
# test the application with cargo-nextest
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
--mount=type=cache,target=/app/target \
|
--mount=type=cache,target=/app/target \
|
||||||
set -eux -o pipefail; \
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
sccache -s; \
|
|
||||||
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
||||||
RUST_LOG=web3_proxy=trace,info \
|
RUST_LOG=web3_proxy=trace,info \
|
||||||
cargo \
|
cargo \
|
||||||
--frozen \
|
--frozen \
|
||||||
--offline \
|
--offline \
|
||||||
nextest run \
|
nextest run \
|
||||||
--build-jobs "$BUILD_JOBS" \
|
|
||||||
--features "$WEB3_PROXY_FEATURES" --no-default-features \
|
--features "$WEB3_PROXY_FEATURES" --no-default-features \
|
||||||
; \
|
; \
|
||||||
sccache -s; \
|
|
||||||
touch /test_success
|
touch /test_success
|
||||||
|
|
||||||
FROM rust_with_env as build_app
|
FROM rust_with_env as build_app
|
||||||
|
|
||||||
# keep the ARGs from the previous step
|
|
||||||
# sccache should be a huge savings here
|
|
||||||
ARG AWS_ACCESS_KEY_ID
|
|
||||||
ARG AWS_PROFILE
|
|
||||||
ARG AWS_SECRET_ACCESS_KEY
|
|
||||||
ARG AWS_SESSION_TOKEN
|
|
||||||
ARG BUILD_JOBS
|
|
||||||
ARG SCCACHE_BUCKET
|
|
||||||
ARG SCCACHE_REGION
|
|
||||||
ARG SCCACHE_S3_KEY_PREFIX
|
|
||||||
ARG SCCACHE_S3_USE_SSL
|
|
||||||
|
|
||||||
# # build the release application
|
# # build the release application
|
||||||
# # using a "release" profile (which install does by default) is **very** important
|
# # using a "release" profile (which install does by default) is **very** important
|
||||||
# # TODO: use the "faster_release" profile which builds with `codegen-units = 1` (but compile is SLOW)
|
# # TODO: use the "faster_release" profile which builds with `codegen-units = 1` (but compile is SLOW)
|
||||||
RUN --mount=type=cache,target=/root/.cargo/git \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
--mount=type=cache,target=/root/.cache/sccache \
|
|
||||||
--mount=type=cache,target=/app/target \
|
--mount=type=cache,target=/app/target \
|
||||||
set -eux -o pipefail; \
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
sccache -s; \
|
|
||||||
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
||||||
cargo install \
|
cargo install \
|
||||||
--jobs "$BUILD_JOBS" \
|
|
||||||
--features "$WEB3_PROXY_FEATURES" \
|
--features "$WEB3_PROXY_FEATURES" \
|
||||||
--frozen \
|
--frozen \
|
||||||
--no-default-features \
|
--no-default-features \
|
||||||
@ -226,7 +133,6 @@ RUN --mount=type=cache,target=/root/.cargo/git \
|
|||||||
--path ./web3_proxy \
|
--path ./web3_proxy \
|
||||||
--root /usr/local \
|
--root /usr/local \
|
||||||
; \
|
; \
|
||||||
sccache -s; \
|
|
||||||
/usr/local/bin/web3_proxy_cli --help | grep 'Usage: web3_proxy_cli'
|
/usr/local/bin/web3_proxy_cli --help | grep 'Usage: web3_proxy_cli'
|
||||||
|
|
||||||
# copy this file so that docker actually creates the build_tests container
|
# copy this file so that docker actually creates the build_tests container
|
||||||
|
Loading…
Reference in New Issue
Block a user