2022-09-20 18:53:30 +03:00
|
|
|
# syntax=docker/dockerfile:1.4.3-labs
|
2023-01-20 15:19:37 +03:00
|
|
|
FROM lukemathwalker/cargo-chef:0.1.51-rust-1.66.1-buster AS chef
|
2021-06-11 21:41:03 +03:00
|
|
|
WORKDIR app
|
2022-10-06 17:43:56 +03:00
|
|
|
|
|
|
|
FROM chef AS planner
|
2021-06-11 21:41:03 +03:00
|
|
|
COPY . .
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
2022-10-06 17:43:56 +03:00
|
|
|
FROM chef AS builder
|
2021-06-11 21:41:03 +03:00
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
2022-11-20 16:18:49 +03:00
|
|
|
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
2021-06-11 21:41:03 +03:00
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
COPY . .
|
2022-04-24 14:13:47 +03:00
|
|
|
RUN cargo build --release --locked --no-default-features
|
2021-06-11 21:41:03 +03:00
|
|
|
RUN rm -f target/release/deps/git_cliff*
|
|
|
|
|
|
|
|
FROM debian:buster-slim as runner
|
|
|
|
COPY --from=builder /app/target/release/git-cliff /usr/local/bin
|
2022-09-20 18:53:30 +03:00
|
|
|
WORKDIR git-home
|
|
|
|
RUN cat <<'EOF' > entrypoint.sh
|
|
|
|
#!/bin/sh
|
|
|
|
cp -r /app /git-home/app
|
|
|
|
cd /git-home/app
|
|
|
|
exec git-cliff "$@"
|
|
|
|
EOF
|
|
|
|
ENTRYPOINT ["sh", "entrypoint.sh"]
|