2026-06-19 13:16:47 -04:00
|
|
|
# Stage 1: Build binary
|
2026-06-19 16:10:43 -04:00
|
|
|
FROM rust:1.85-bookworm AS builder
|
2026-06-19 13:16:47 -04:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN cargo build --release
|
|
|
|
|
|
|
|
|
|
# Stage 2: Final minimal execution layer
|
|
|
|
|
FROM debian:bookworm-slim
|
2026-06-19 16:43:12 -04:00
|
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
2026-06-19 17:20:33 -04:00
|
|
|
|
|
|
|
|
# Set global installation paths BEFORE installing Rust
|
|
|
|
|
ENV RUSTUP_HOME=/usr/local/rustup
|
|
|
|
|
ENV CARGO_HOME=/usr/local/cargo
|
|
|
|
|
ENV PATH="/usr/local/cargo/bin:${PATH}"
|
|
|
|
|
|
|
|
|
|
# Install Rust (it will now install to the paths above)
|
2026-06-19 17:25:14 -04:00
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://rustup.rs | bash -s -- -y
|
2026-06-19 17:20:33 -04:00
|
|
|
|
|
|
|
|
# Grant read and execute permissions to all users
|
|
|
|
|
RUN chmod -R 755 /usr/local/cargo /usr/local/rustup
|
|
|
|
|
|
2026-06-19 13:16:47 -04:00
|
|
|
WORKDIR /app
|
2026-06-19 16:10:43 -04:00
|
|
|
COPY --from=builder /app/target/release/huffman-compression-rs /app/huffman-compression-rust
|
2026-06-19 16:43:12 -04:00
|
|
|
ENTRYPOINT ["/app/huffman-compression-rust"]
|