drop cargo-chef
This commit is contained in:
parent
8f6371be30
commit
b1c414f85e
45
Dockerfile
45
Dockerfile
@ -37,14 +37,13 @@ RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|||||||
\
|
\
|
||||||
cargo check || [ "$?" -eq 101 ]
|
cargo check || [ "$?" -eq 101 ]
|
||||||
|
|
||||||
# chef splits up the rust build to hopefully cache better
|
|
||||||
# hakari manages a 'workspace-hack' to hopefully build faster
|
# hakari manages a 'workspace-hack' to hopefully build faster
|
||||||
# nextest runs tests in parallel
|
# nextest runs tests in parallel
|
||||||
# We only pay the installation cost once, it will be cached from the second build onwards
|
# We only pay the installation cost once, it will be cached from the second build onwards
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
\
|
\
|
||||||
cargo install --locked cargo-chef cargo-hakari cargo-nextest
|
cargo install --locked cargo-hakari cargo-nextest
|
||||||
|
|
||||||
# foundry/anvil are needed to run tests
|
# foundry/anvil are needed to run tests
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
||||||
@ -55,46 +54,26 @@ RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|||||||
# 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 "rdkafka-src,connectinfo"
|
ENV WEB3_PROXY_FEATURES "rdkafka-src,connectinfo"
|
||||||
|
|
||||||
# check hakari and chef prep
|
FROM rust as build_tests
|
||||||
COPY . .
|
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
# check hakari and test the application with cargo-nextest
|
||||||
|
RUN --mount=type=bind,target=. \
|
||||||
|
--mount=type=cache,target=/usr/local/cargo/git \
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/app/target \
|
--mount=type=cache,target=/app/target,sharing=private \
|
||||||
\
|
\
|
||||||
cargo hakari generate --diff && \
|
cargo hakari generate --diff && \
|
||||||
cargo hakari manage-deps --dry-run && \
|
cargo hakari manage-deps --dry-run && \
|
||||||
cargo chef prepare --recipe-path recipe.json
|
|
||||||
|
|
||||||
FROM rust as build_tests
|
|
||||||
|
|
||||||
# chef cook the test app
|
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
|
||||||
--mount=type=cache,target=/app/target,sharing=private \
|
|
||||||
\
|
|
||||||
cargo chef cook --recipe-path recipe.json
|
|
||||||
|
|
||||||
# test the application with cargo-nextest
|
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
|
||||||
--mount=type=cache,target=/app/target,sharing=private \
|
|
||||||
\
|
|
||||||
RUST_LOG=web3_proxy=trace,info cargo --locked nextest run --features "$WEB3_PROXY_FEATURES" --no-default-features && \
|
RUST_LOG=web3_proxy=trace,info cargo --locked nextest run --features "$WEB3_PROXY_FEATURES" --no-default-features && \
|
||||||
touch /test_success
|
touch /test_success
|
||||||
|
|
||||||
FROM rust as build_app
|
FROM rust as build_app
|
||||||
|
|
||||||
# chef cook the release app
|
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
|
||||||
--mount=type=cache,target=/app/target,sharing=private \
|
|
||||||
\
|
|
||||||
cargo chef cook --release --recipe-path recipe.json
|
|
||||||
|
|
||||||
# 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`
|
# TODO: use the "faster_release" profile which builds with `codegen-units = 1` (but compile is SLOW)
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/git \
|
RUN --mount=type=bind,target=. \
|
||||||
|
--mount=type=cache,target=/usr/local/cargo/git \
|
||||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/app/target,sharing=private \
|
--mount=type=cache,target=/app/target,sharing=private \
|
||||||
\
|
\
|
||||||
@ -103,8 +82,8 @@ RUN --mount=type=cache,target=/usr/local/cargo/git \
|
|||||||
--locked \
|
--locked \
|
||||||
--no-default-features \
|
--no-default-features \
|
||||||
--path ./web3_proxy \
|
--path ./web3_proxy \
|
||||||
--root /usr/local \
|
--root /usr/local && \
|
||||||
&& [ -e /usr/local/bin/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
|
||||||
# without this, the runtime container doesn't need build_tests and so docker build skips it
|
# without this, the runtime container doesn't need build_tests and so docker build skips it
|
||||||
|
Loading…
Reference in New Issue
Block a user