From 7ede9e2e637f8e91cd096313da14125cd0b2a9a4 Mon Sep 17 00:00:00 2001 From: Shaurya Gupta Date: Sat, 7 Dec 2024 20:01:51 +0530 Subject: [PATCH 1/3] Fix cache issue in docker builds Fix not using cache for building docker images --- .github/workflows/deploy.yml | 4 ++-- .github/workflows/reusable-test.yml | 4 ++-- docker/prod.Dockerfile | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 34b73cff0a..f6cfc30773 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -103,8 +103,8 @@ jobs: build-args: | APP_VERSION=${{ github.sha }} ADDITIONAL_PLUGS=${{ env.ADDITIONAL_PLUGS }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + cache-from: type=gha + cache-to: type=gha,mode=max - name: Create Sentry release uses: getsentry/action-release@v1 diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml index baec75ebbb..b401e141f0 100644 --- a/.github/workflows/reusable-test.yml +++ b/.github/workflows/reusable-test.yml @@ -34,8 +34,8 @@ jobs: with: load: true set: | - *.cache-from=type=local,src=/tmp/.buildx-cache - *.cache-to=type=local,dest=/tmp/.buildx-cache-new + *.cache-from=type=gha + *.cache-to=type=gha,mode=max files: docker-compose.yaml,docker-compose.local.yaml env: DOCKER_BUILD_SUMMARY: false diff --git a/docker/prod.Dockerfile b/docker/prod.Dockerfile index 99f724066f..9ff225aa31 100644 --- a/docker/prod.Dockerfile +++ b/docker/prod.Dockerfile @@ -47,11 +47,11 @@ RUN pip install pipenv==2024.4.0 RUN python -m venv $APP_HOME/.venv COPY Pipfile Pipfile.lock $APP_HOME/ -RUN pipenv install --deploy --categories "packages" +RUN --mount=type=cache,target=/root/.cache/pip pipenv install --deploy --categories "packages" COPY plugs/ $APP_HOME/plugs/ COPY install_plugins.py plug_config.py $APP_HOME/ -RUN python3 $APP_HOME/install_plugins.py +RUN --mount=type=cache,target=/root/.cache/pip python3 $APP_HOME/install_plugins.py # --- FROM base AS runtime From 11d0e69e0c42f0b61524814213f6c5052d5426c6 Mon Sep 17 00:00:00 2001 From: Shaurya Gupta Date: Sat, 7 Dec 2024 20:12:05 +0530 Subject: [PATCH 2/3] fix coderabbitai comments --- .github/workflows/deploy.yml | 5 ----- .github/workflows/reusable-test.yml | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f6cfc30773..d58ae5a27c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -115,11 +115,6 @@ jobs: with: version: ${{ github.sha }} - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - notify-release: needs: build if: startsWith(github.event.ref, 'refs/tags/v') diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml index b401e141f0..99f4a140b6 100644 --- a/.github/workflows/reusable-test.yml +++ b/.github/workflows/reusable-test.yml @@ -69,18 +69,6 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - name: Move new cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - - name: Save Docker layers cache - if: ${{ inputs.event_name == 'push' || github.event_name == 'push' }} - uses: actions/cache/save@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ hashFiles('Pipfile.lock', 'docker/dev.Dockerfile') }} - - name: Upload db artifact if: ${{ inputs.event_name == 'push' || github.event_name == 'push' }} uses: actions/upload-artifact@v4 From bdd555ecab2b3c9c4260b22b6378379f36e92bc9 Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Fri, 20 Dec 2024 18:49:33 +0530 Subject: [PATCH 3/3] test commit