git-next/Dockerfile
Paul Campbell b5a1dd4326
Some checks failed
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/push/todo-check Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/docker Pipeline failed
ci/woodpecker/manual/build Pipeline failed
ci/woodpecker/manual/release Pipeline was successful
ci/woodpecker/manual/docker Pipeline was successful
ci/woodpecker/manual/todo-check Pipeline was successful
ci/woodpecker/cron/release Pipeline was successful
ci/woodpecker/cron/todo-check Pipeline failed
ci/woodpecker/cron/docker Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
build(docker): add Dockerfile and builder
2024-04-07 16:20:04 +01:00

33 lines
1 KiB
Docker

# Leveraging the pre-built Docker images with
# cargo-chef and the Rust toolchain
FROM git.kemitix.net/kemitix/git-next-builder:latest AS builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src src
RUN cargo chef prepare --recipe-path recipe.json
ARG CARGO_PROFILE
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --profile "$CARGO_PROFILE" --recipe-path recipe.json
# Build application
COPY Cargo.toml Cargo.lock ./
COPY src src
ARG CARGO_PROFILE
RUN cargo build --profile "$CARGO_PROFILE" --bin git-next
RUN if test "$CARGO_PROFILE" == "release" ; then strip target/release/git-next ; fi
# We do not need the Rust toolchain to run the binary!
FROM docker.io/debian:stable-20240211-slim AS runtime
WORKDIR /app
RUN apt-get update && \
apt-get install --no-install-recommends -y \
libssl3=3.0.11-1~deb12u2 \
ca-certificates=20230311 \
&& \
rm -rf /var/lib/apt/lists/*
USER 1000
ARG CARGO_TARGET
COPY --from=builder /app/target/"$CARGO_TARGET"/git-next /usr/local/bin
ENTRYPOINT [ "/usr/local/bin/git-next" ]