diff options
| author | Max Audron <audron@cocaine.farm> | 2021-09-07 13:38:43 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-09-07 13:38:43 +0200 |
| commit | 3f555f977a7f5c3f23a945281a6564170d5d9bf0 (patch) | |
| tree | 1cd0fe4a973a53efa4ece39b636314370d5c7684 | |
| parent | handle CTCP ACTION in sed module (diff) | |
add cargo chef to container build to utilize caching
| -rw-r--r-- | Containerfile | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Containerfile b/Containerfile index 7bf429e..b3b7ba3 100644 --- a/Containerfile +++ b/Containerfile @@ -2,26 +2,30 @@ # Cargo Build Stage # ------------------------------------------------------------------------------ -FROM docker.io/rust:1.52-alpine as cargo-build - -RUN rustup default nightly && rustup update - +FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.54.0-alpine AS chef WORKDIR /work +FROM chef AS planner COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef AS builder +COPY --from=planner /work/recipe.json recipe.json -RUN apk add --no-cache musl-dev +RUN cargo chef cook --release --recipe-path recipe.json + +COPY . . RUN cargo build --release # ------------------------------------------------------------------------------ # Final Stage # ------------------------------------------------------------------------------ -FROM alpine:3.13 +FROM scratch -COPY --from=cargo-build /work/target/release/catinator /usr/local/bin +COPY --from=builder /work/target/release/catinator /usr/local/bin ENV CATINATOR_CONFIG="/config.toml" ENV CATINATOR_PASSWORD="" -CMD ["/usr/local/bin/catinator"] +ENTRYPOINT ["/usr/local/bin/catinator"] |
