Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# syntax=docker/dockerfile:1.7-labs
### STAGE 0: Create base chef image for building
### cargo chef is used to speed up the build process by caching dependencies using docker
FROM --platform=$TARGETPLATFORM lukemathwalker/cargo-chef:latest-rust-latest as chef
### Use a Debian bookworm-based Rust image so GLIBC matches the final runtime (bookworm ships glibc 2.36)
### cargo-chef is then installed into this pinned base
FROM --platform=$TARGETPLATFORM rust:bookworm AS chef

RUN cargo install cargo-chef

Expand All @@ -20,7 +21,11 @@ RUN cargo chef prepare
### this takes advantage of docker layer caching to the max
FROM chef as builder
COPY --from=planner /app/recipe.json recipe.json
RUN apt-get update && apt-get -y upgrade && apt-get install -y gcc libclang-dev pkg-config libssl-dev
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
gcc \
libclang-dev \
pkg-config \
libssl-dev

RUN --mount=type=ssh cargo chef cook --release --recipe-path recipe.json --bin zenith-builder-example
COPY --exclude=target . .
Expand All @@ -29,7 +34,9 @@ RUN --mount=type=ssh cargo build --release --bin zenith-builder-example

# Stage 3: Final image for running in the env
FROM --platform=$TARGETPLATFORM debian:bookworm-slim
RUN apt-get update && apt-get -y upgrade && apt-get install -y libssl-dev ca-certificates
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
libssl-dev \
ca-certificates

COPY --from=builder /app/target/release/zenith-builder-example /usr/local/bin/zenith-builder-example

Expand Down