Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

Commit 1d28bcf

Browse files
committed
fix(docker): rewrite Dockerfile for standalone build with Alpine
- Use Alpine Linux instead of Debian for smaller image size - Build as standalone using published solverforge crate from crates.io - Remove dependency on local solverforge-rs workspace - Build with musl target for static linking - Build context is now just rust/employee-scheduling/ (works with CI)
1 parent e65e1a4 commit 1d28bcf

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

rust/employee-scheduling/Dockerfile

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
11
# Multi-stage build for SolverForge Employee Scheduling (Rust)
22
#
3-
# Build context should be the parent directory containing both:
4-
# - solverforge-rs/
5-
# - solverforge-quickstarts/
6-
#
7-
# Example:
8-
# docker build -f solverforge-quickstarts/rust/employee-scheduling/Dockerfile \
9-
# -t employee-scheduling-rust .
10-
11-
FROM rust:1.83-bookworm AS builder
3+
# Build context: rust/employee-scheduling/
4+
# Uses published solverforge crate from crates.io
125

13-
WORKDIR /build
6+
FROM rust:1.83-alpine AS builder
147

15-
# Copy solverforge-rs workspace (local dependency)
16-
COPY solverforge-rs/ ./solverforge-rs/
8+
# Install build dependencies
9+
RUN apk add --no-cache musl-dev
1710

18-
# Copy quickstarts
19-
COPY solverforge-quickstarts/rust/employee-scheduling/ ./solverforge-quickstarts/rust/employee-scheduling/
11+
WORKDIR /build
2012

21-
WORKDIR /build/solverforge-quickstarts/rust/employee-scheduling
13+
# Copy workspace files
14+
COPY Cargo.toml Cargo.lock ./
15+
COPY src/ ./src/
16+
COPY static/ ./static/
17+
COPY solver.toml ./
2218

23-
# Build release binary
24-
RUN cargo build --release
19+
# Build release binary with musl target for static linking
20+
RUN cargo build --release --target x86_64-unknown-linux-musl
2521

26-
# Runtime stage - minimal image
27-
FROM debian:bookworm-slim
22+
# Runtime stage - minimal Alpine image
23+
FROM alpine:latest
2824

29-
RUN apt-get update && \
30-
apt-get install -y --no-install-recommends ca-certificates && \
31-
rm -rf /var/lib/apt/lists/*
25+
RUN apk add --no-cache ca-certificates
3226

3327
WORKDIR /app
3428

35-
# Copy binary from builder
36-
COPY --from=builder /build/solverforge-quickstarts/rust/employee-scheduling/target/release/employee-scheduling ./employee-scheduling
29+
# Copy binary from builder (musl static binary)
30+
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/employee-scheduling ./employee-scheduling
3731

3832
# Copy static files
39-
COPY --from=builder /build/solverforge-quickstarts/rust/employee-scheduling/static/ ./static/
33+
COPY --from=builder /build/static/ ./static/
4034

4135
# Copy solver config
42-
COPY --from=builder /build/solverforge-quickstarts/rust/employee-scheduling/solver.toml ./solver.toml
36+
COPY --from=builder /build/solver.toml ./solver.toml
4337

4438
# Expose port 7860 (HF Spaces default)
4539
EXPOSE 7860

0 commit comments

Comments
 (0)