# syntax=docker/dockerfile:1 # ── Build stage ─────────────────────────────────────────────────────────────── # Native build: Cargo targets the host platform automatically. # No --target flag means no cross-compiler confusion regardless of which # arch podman-compose runs on (x86_64, arm64, armv7…). FROM docker.io/library/rust:1.94-slim-bookworm AS builder # gcc is required by cc-rs (used by aes-gcm / ring build scripts). # rust:slim does not include a C compiler. RUN apt-get update && apt-get install -y gcc pkg-config && \ rm -rf /var/lib/apt/lists/* WORKDIR /build # Cache dependency compilation separately from application 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 COPY server/templates ./server/templates RUN touch server/src/main.rs && \ cargo build --release -p hiy-server # ── Runtime stage ───────────────────────────────────────────────────────────── FROM docker.io/library/debian:bookworm-slim RUN apt-get update && apt-get install -y \ ca-certificates \ git \ curl \ bash \ python3 \ podman \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /build/target/release/hiy-server /usr/local/bin/hiy-server WORKDIR /app CMD ["hiy-server"]