Hostityourself/infra/Dockerfile.server
Claude 4e8aa1614e
fix: pin builder to rust:1.77-slim-bookworm to match runtime glibc
rust:1.77-slim has drifted to a newer Debian base with glibc 2.39,
but debian:bookworm-slim only has glibc 2.36, causing a GLIBC_2.39
not found error at runtime. Pinning to the explicit bookworm variant
keeps both stages on the same glibc version.
2026-03-19 10:45:51 +00:00

38 lines
1.3 KiB
Text

# ── Build stage ───────────────────────────────────────────────────────────────
FROM rust:1.77-slim-bookworm AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y \
pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies separately from source.
COPY Cargo.toml Cargo.lock* ./
COPY server/Cargo.toml ./server/
RUN mkdir -p server/src && echo 'fn main(){}' > server/src/main.rs
RUN cargo build --release -p hiy-server 2>/dev/null || true
RUN rm -f server/src/main.rs
# Build actual source.
COPY server/src ./server/src
RUN touch server/src/main.rs && cargo build --release -p hiy-server
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
git \
curl \
bash \
python3 \
# Docker CLI (no daemon — uses host socket)
docker.io \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/target/release/hiy-server /usr/local/bin/hiy-server
WORKDIR /app
CMD ["hiy-server"]