Skip to content

Commit

Permalink
[Dockerfile][Experimental] Remove cargo-chef and sequence builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalajiarun committed Mar 1, 2023
1 parent 068cb0d commit fae6409
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 23 deletions.
21 changes: 0 additions & 21 deletions docker/experimental/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
binutils \
lld

# install cargo chef to cache dependencies
RUN --mount=type=cache,target=/root/.cargo <<EOT
cargo install [email protected]
cargo install cargo-cache --no-default-features --features ci-autoclean
EOT

### Build Rust dependencies ###
FROM rust-base as planner

COPY --link . .
RUN cargo chef prepare --recipe-path recipe.json

### Build Rust code ###
FROM rust-base as builder-base

Expand All @@ -52,15 +40,6 @@ RUN ARCHITECTURE=$(uname -m | sed -e "s/arm64/arm_64/g" | sed -e "s/aarch64/aarc
&& chmod +x "/usr/local/bin/protoc" \
&& rm "protoc-21.5-linux-$ARCHITECTURE.zip"

# Use cargo chef
COPY --link --from=planner /aptos/recipe.json recipe.json

# Build dependencies - this is the caching Docker layer!
RUN <<EOT
cargo chef cook --profile ${PROFILE} --workspace --recipe-path recipe.json
cargo cache
EOT

COPY --link . /aptos/

FROM builder-base as aptos-node-builder
Expand Down
3 changes: 1 addition & 2 deletions docker/experimental/debian-base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ FROM debian AS debian-base
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

# Add Tini to make sure the binaries receive proper SIGTERM signals when Docker is shut down
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ADD --chmod=755 https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
ENTRYPOINT ["/tini", "--"]
4 changes: 4 additions & 0 deletions docker/experimental/docker-bake-rust-all.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ group "forge-images" {
targets = ["validator-testing", "tools", "forge"]
}

group "build" {
targets = ["aptos-node-builder", "tools-builder"]
}

target "debian-base" {
dockerfile = "docker/experimental/debian-base.Dockerfile"
context = "."
Expand Down
2 changes: 2 additions & 0 deletions docker/experimental/docker-bake-rust-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ fi

BUILD_TARGET="${1:-forge-images}"
if [ "$CI" == "true" ]; then
TARGET_REGISTRY=remote docker buildx bake --progress=plain --file docker/experimental/docker-bake-rust-all.hcl builder-base
TARGET_REGISTRY=remote docker buildx bake --progress=plain --file docker/experimental/docker-bake-rust-all.hcl build
TARGET_REGISTRY=remote docker buildx bake --progress=plain --file docker/experimental/docker-bake-rust-all.hcl --push $BUILD_TARGET
else
TARGET_REGISTRY=local docker buildx bake --file docker/experimental/docker-bake-rust-all.hcl $BUILD_TARGET --load
Expand Down

0 comments on commit fae6409

Please sign in to comment.