40 lines
1.3 KiB
Docker
40 lines
1.3 KiB
Docker
# Leveraging the pre-built Docker images with
|
|
# cargo-chef and the Rust toolchain
|
|
FROM docker.io/rust:1.83.0-bookworm AS chef
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y libdbus-1-dev && \
|
|
curl -L https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \
|
|
tar -xzf cargo-binstall.tgz && \
|
|
rm cargo-binstall.tgz && \
|
|
mv cargo-binstall /usr/local/bin/ && \
|
|
cargo binstall -y cargo-chef && \
|
|
rustup component add rustfmt clippy
|
|
|
|
WORKDIR /app
|
|
|
|
FROM chef AS planner
|
|
COPY Cargo.toml ./
|
|
COPY crates crates
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
RUN cargo chef cook --profile release --recipe-path recipe.json
|
|
COPY . .
|
|
RUN cargo build --release --bin git-next --all-features && \
|
|
strip target/release/git-next
|
|
|
|
FROM docker.io/debian:stable-20240904-slim AS runtime
|
|
WORKDIR /app
|
|
RUN apt-get update && \
|
|
apt-get satisfy -y "git (>=2.39), libssl3 (>=3.0.14), libdbus-1-dev (>=1.14.10), ca-certificates (>=20230311)" \
|
|
&& \
|
|
rm -rf /var/lib/apt/lists/*
|
|
USER 1000
|
|
COPY --from=builder /app/target/release/git-next /usr/local/bin
|
|
|
|
ENV HOME=/app
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/git-next" ]
|
|
CMD [ "server", "start" ]
|