build(docker): clean up and update debian version
Some checks failed
ci/woodpecker/tag/cron-docker-builder Pipeline was successful
ci/woodpecker/tag/push-next Pipeline was successful
ci/woodpecker/tag/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline failed
ci/woodpecker/push/push-next Pipeline failed
ci/woodpecker/push/tag-created Pipeline failed
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
Some checks failed
ci/woodpecker/tag/cron-docker-builder Pipeline was successful
ci/woodpecker/tag/push-next Pipeline was successful
ci/woodpecker/tag/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline failed
ci/woodpecker/push/push-next Pipeline failed
ci/woodpecker/push/tag-created Pipeline failed
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
This commit is contained in:
parent
4d352f005d
commit
e34d5c2c2c
2 changed files with 12 additions and 22 deletions
|
@ -1,5 +1,4 @@
|
|||
steps:
|
||||
|
||||
publish-to-forgejo:
|
||||
when:
|
||||
- event: tag
|
||||
|
@ -23,9 +22,6 @@ steps:
|
|||
username: kemitix
|
||||
repo: git.kemitix.net/kemitix/git-next
|
||||
dockerfile: Dockerfile
|
||||
build_args:
|
||||
- CARGO_PROFILE=release
|
||||
- CARGO_TARGET=release
|
||||
auto_tag: true
|
||||
dry-run: false # push to remote repo
|
||||
registry: git.kemitix.net
|
||||
|
|
30
Dockerfile
30
Dockerfile
|
@ -1,26 +1,21 @@
|
|||
# Leveraging the pre-built Docker images with
|
||||
# cargo-chef and the Rust toolchain
|
||||
FROM git.kemitix.net/kemitix/git-next-builder:latest AS builder
|
||||
FROM git.kemitix.net/kemitix/git-next-builder:latest AS chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef as planner
|
||||
COPY Cargo.toml ./
|
||||
COPY src src
|
||||
COPY crates crates
|
||||
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 ./
|
||||
COPY src src
|
||||
COPY default.toml ./
|
||||
COPY server-default.toml ./
|
||||
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
|
||||
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 && \
|
||||
strip target/release/git-next
|
||||
|
||||
# We do not need the Rust toolchain to run the binary!
|
||||
FROM docker.io/debian:stable-20240211-slim AS runtime
|
||||
FROM docker.io/debian:stable-20240423-slim AS runtime
|
||||
WORKDIR /app
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
|
@ -29,7 +24,6 @@ RUN apt-get update && \
|
|||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
USER 1000
|
||||
COPY --from=builder /app/target/release/git-next /usr/local/bin
|
||||
|
||||
ARG CARGO_TARGET
|
||||
COPY --from=builder /app/target/"$CARGO_TARGET"/git-next /usr/local/bin
|
||||
ENTRYPOINT [ "/usr/local/bin/git-next" ]
|
||||
ENTRYPOINT [ "/usr/local/bin/git-next", "server", "start" ]
|
||||
|
|
Loading…
Reference in a new issue