- Replace complex caching with simple Dockerfile - Remove cargo-chef complexity that was slowing builds - Add .woodpecker-base.yml for separate base image builds - Add Dockerfile.simple for faster builds - Add Dockerfile.ultrafast for when base image exists
38 lines
934 B
Text
38 lines
934 B
Text
# Simple fast Dockerfile - no fancy caching, just builds fast
|
|
# Uses local cargo cache between builds
|
|
|
|
ARG SERVICE_NAME
|
|
|
|
FROM rust:alpine AS builder
|
|
ARG SERVICE_NAME
|
|
|
|
# Install deps
|
|
RUN apk add --no-cache musl-dev pkgconfig openssl-dev && \
|
|
rustup target add x86_64-unknown-linux-musl
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy manifests first for better caching
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/ ./crates/
|
|
|
|
# Copy the specific service
|
|
COPY apps/${SERVICE_NAME}/ ./apps/${SERVICE_NAME}/
|
|
|
|
# Build with all optimizations
|
|
ENV RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-s"
|
|
RUN cargo build --release \
|
|
--bin ${SERVICE_NAME} \
|
|
--target x86_64-unknown-linux-musl
|
|
|
|
# Runtime
|
|
FROM scratch
|
|
ARG SERVICE_NAME
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/${SERVICE_NAME} /app/service
|
|
|
|
USER 65532:65532
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["/app/service"]
|