Some checks failed
build-and-release / build (companies) (push) Failing after 39s
build-and-release / build (catering-services) (push) Failing after 57s
build-and-release / build (cron) (push) Failing after 1m4s
build-and-release / build (gateway) (push) Successful in 3m46s
build-and-release / build (fitness-trainers) (push) Successful in 9m8s
build-and-release / build (graphic-designers) (push) Successful in 8m58s
build-and-release / build (employees) (push) Successful in 9m17s
build-and-release / build (customers) (push) Successful in 9m47s
build-and-release / build (developers) (push) Successful in 9m48s
build-and-release / build (job-seekers) (push) Successful in 9m1s
build-and-release / build (jobs) (push) Successful in 4m17s
build-and-release / build (leads) (push) Successful in 8m23s
build-and-release / build (makeup-artists) (push) Successful in 8m40s
build-and-release / build (payments) (push) Successful in 9m21s
build-and-release / build (photographers) (push) Successful in 9m20s
build-and-release / build (social-media-managers) (push) Successful in 8m9s
build-and-release / build (tutors) (push) Successful in 8m16s
build-and-release / build (ugc-content-creators) (push) Successful in 6m59s
build-and-release / build (video-editors) (push) Successful in 6m9s
build-and-release / build (users) (push) Successful in 8m37s
38 lines
1.1 KiB
Text
38 lines
1.1 KiB
Text
# Super-fast Dockerfile using pre-compiled dependencies
|
|
# This requires building a base image first with: cargo chef cook
|
|
|
|
ARG SERVICE_NAME
|
|
|
|
# Stage 1: Use pre-built base with all dependencies cached
|
|
# Build base with: docker build -f Dockerfile.base -t registry.nxtgauge.com/nxtgauge-rust-base:latest .
|
|
FROM ci.nxtgauge.com/admin/nxtgauge-rust-base:latest AS builder
|
|
ARG SERVICE_NAME
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy ONLY the service source code (fast!)
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/ ./crates/
|
|
COPY apps/${SERVICE_NAME}/ ./apps/${SERVICE_NAME}/
|
|
|
|
# Build with optimizations for size and speed
|
|
ENV RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-s -C opt-level=z"
|
|
ENV CARGO_NET_OFFLINE=true
|
|
|
|
# Build just this service - dependencies already compiled!
|
|
RUN cargo build --release \
|
|
--bin ${SERVICE_NAME} \
|
|
--target x86_64-unknown-linux-musl \
|
|
2>&1 | tail -20
|
|
|
|
# Stage 2: Minimal 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"]
|