Use new and improved rust workflow and Dockerfile

This commit is contained in:
2025-08-23 01:45:49 +02:00
parent d6ab38f690
commit 01e88eeb3b
3 changed files with 33 additions and 75 deletions

View File

@@ -1,8 +1,26 @@
FROM gcr.io/distroless/cc-debian12:nonroot
FROM rust:1.86 AS base
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef --locked --version 0.1.71 && \
cargo install cargo-auditable --locked --version 0.6.6
WORKDIR /app
FROM base AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM base AS builder
# HACK: Now we can use unstable feature while on stable rust!
ENV RUSTC_BOOTSTRAP=1
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
RUN cargo auditable build --release
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
COPY --from=builder /app/target/release/automation /app/automation
ENV AUTOMATION_CONFIG=/app/config.lua
COPY ./config.lua /app/config.lua
COPY ./automation /app/automation
CMD ["/app/automation"]
CMD [ "/app/automation" ]