From 3f52c785c37e1551db3a59c4c7a5127aa58e2dba Mon Sep 17 00:00:00 2001 From: toast Date: Mon, 8 Jan 2024 02:51:59 +1100 Subject: [PATCH] I suppose? --- .gitea/workflows/build.yml | 22 ++++++++++++++++++++-- .gitea/workflows/cache.yml | 31 ------------------------------- Dockerfile | 4 +--- 3 files changed, 21 insertions(+), 36 deletions(-) delete mode 100644 .gitea/workflows/cache.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index c0da062..eb34cc9 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -31,7 +31,25 @@ jobs: id: restore-cache with: path: /tmp/.buildx-cache - key: docker-buildx-kon + key: docker-buildx-kon- + + - name: Cache cargo registry + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo index + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 @@ -49,4 +67,4 @@ jobs: id: cache with: path: /tmp/.buildx-cache - key: docker-buildx-kon + key: docker-buildx-kon-${{ github.sha }} diff --git a/.gitea/workflows/cache.yml b/.gitea/workflows/cache.yml deleted file mode 100644 index 45d9028..0000000 --- a/.gitea/workflows/cache.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Cache Rust dependencies -on: - push: - branches: - - master -jobs: - build: - runs-on: ubuntu-22.04-node - steps: - - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2 - - - name: Cache cargo registry - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo index - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo build - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - - - name: Build - run: cargo build -r --verbose diff --git a/Dockerfile b/Dockerfile index ceffe00..aca6ea0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,8 @@ FROM rust:1.75-alpine3.19@sha256:8eaab14d138f0d61240da09aeadb87fcd9c2593975b8852 ENV RUSTFLAGS="-C target-feature=-crt-static" RUN apk add --no-cache openssl-dev musl-dev WORKDIR /usr/src/kon -COPY Cargo.toml Cargo.lock ./ -RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build -r && rm -rf src COPY . . -RUN --mount=type=cache,target=/tmp/.buildx-cache/kon-cargo cargo fetch && cargo build -r +RUN cargo fetch && cargo build -r FROM alpine:3.19@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 RUN apk add --no-cache openssl-dev libgcc