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