File size: 1,023 Bytes
195a426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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

WORKDIR /build

# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY src/ ./src/
COPY static/ ./static/
COPY solver.toml ./

# 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/employee-scheduling ./employee-scheduling

# Copy static files
COPY --from=builder /build/static/ ./static/

# Copy solver config
COPY --from=builder /build/solver.toml ./solver.toml

# Expose port 7860 (HF Spaces default)
EXPOSE 7860

# Run the application
CMD ["./employee-scheduling"]