From 941e5f0bc4a18e3ec9286e98c463b7111b6f6eaa Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 21 Sep 2024 21:37:45 +0300 Subject: [PATCH] Use a cache-less Dockerfile for CI to try and avoid issues --- .github/workflows/workflow.yml | 1 + Dockerfile.ci | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Dockerfile.ci diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5ad3b82..3513769 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -53,3 +53,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + file: Dockerfile.ci diff --git a/Dockerfile.ci b/Dockerfile.ci new file mode 100644 index 0000000..e65de8c --- /dev/null +++ b/Dockerfile.ci @@ -0,0 +1,35 @@ +####################################### +# # +# Stage 1: building # +# # +####################################### + +FROM docker.io/rust:1.81.0-slim-bookworm AS build + +RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev + +WORKDIR /app + +COPY . /app + +RUN cargo build --release + +####################################### +# # +# Stage 2: packaging # +# # +####################################### + +FROM docker.io/debian:bookworm-slim + +RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY --from=build /app/target/release/baibot . + +ENTRYPOINT ["/bin/sh", "-c"] + +CMD ["/app/baibot"]