- Add Dockerfile.fast with cargo-chef and symbol stripping - Add Dockerfile.superfast using pre-built base image - Add Dockerfile.base for dependency caching - Update Woodpecker with registry cache (cache_from/cache_to) - Add fast-build.sh for local ultra-fast builds - Add build-base-image.sh for one-time dependency build - Enable BuildKit layer caching in CI
24 lines
698 B
Text
24 lines
698 B
Text
# Base image with all dependencies pre-compiled
|
|
# Build once, use for all services
|
|
|
|
FROM rust:alpine AS chef
|
|
RUN apk add --no-cache musl-dev pkgconfig openssl-dev && \
|
|
rustup target add x86_64-unknown-linux-musl && \
|
|
cargo install cargo-chef
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy all manifests
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/ ./crates/
|
|
COPY apps/ ./apps/
|
|
|
|
# Prepare and cook all dependencies
|
|
RUN cargo chef prepare --recipe-path recipe.json && \
|
|
cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
|
|
|
|
# Keep this layer as the base
|
|
FROM chef
|
|
|
|
# The target directory now has all dependencies compiled!
|
|
# Services can copy just their source and build instantly
|