| # Multi-stage build for SolverForge Employee Scheduling (Rust) | |
| # | |
| # Build context: rust/employee-scheduling/ | |
| # Uses published solverforge crate from crates.io | |
| FROM rust:1.83-alpine AS builder | |
| # Install build dependencies | |
| RUN apk add --no-cache musl-dev curl | |
| WORKDIR /build | |
| # Copy workspace files | |
| COPY Cargo.toml Cargo.lock ./ | |
| COPY src/ ./src/ | |
| COPY static/ ./static/ | |
| # Build release binary with musl target for static linking | |
| RUN cargo build --release --target x86_64-unknown-linux-musl | |
| # Runtime stage - minimal Alpine image | |
| FROM alpine:latest | |
| RUN apk add --no-cache ca-certificates | |
| WORKDIR /app | |
| # Copy binary from builder (musl static binary) | |
| COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/vehicle-routing ./vehicle-routing | |
| # Copy static files | |
| COPY --from=builder /build/static/ ./static/ | |
| # Expose port 7860 (HF Spaces default) | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["./vehicle-routing"] | |