From 9e0aa655a0b7926a0e6132e43939d0c506740530 Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 22 Nov 2022 21:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20workflow=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_docker_image.yml | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml index a3cb87de..bb3cd242 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml @@ -50,13 +50,22 @@ jobs: - uses: pnpm/action-setup@v2 with: version: latest - - uses: actions/setup-node@v3 + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v3 with: - cache: 'pnpm' + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yml') }} + restore-keys: | + ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yml') }} + + - name: Install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: pnpm install - name: build front and back run: | - pnpm install --frozen-lockfile pnpm build:front pnpm build:back @@ -147,14 +156,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Build and push id: docker_build uses: docker/build-push-action@v3 @@ -168,8 +169,6 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }}