diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a77b2a49..5123a6be 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,4 +1,5 @@ name: Build and Push Docker Image + on: push: branches: @@ -22,10 +23,18 @@ jobs: with: node-version: '18' + - name: Cache Node Modules + uses: actions/cache@v3 + with: + path: frontend/node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('frontend/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + - name: Install Dependencies and Build Frontend run: | cd frontend - npm install + npm ci npm run build - name: Setup Docker Buildx @@ -45,10 +54,8 @@ jobs: run: | echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV if [ "${{ github.event.inputs.tag_name }}" == "" ]; then - # If the tag_name input is an empty string, default to branch-name-development-latest IMAGE_TAG="${{ github.ref_name }}-development-latest" else - # If tag_name is provided, use it IMAGE_TAG="${{ github.event.inputs.tag_name }}" fi echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV @@ -61,8 +68,8 @@ jobs: push: true tags: ghcr.io/${{ env.REPO_OWNER }}/ssh-project:${{ env.IMAGE_TAG }} labels: org.opencontainers.image.source=https://github.com/${{ github.repository }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,ref=ghcr.io/${{ env.REPO_OWNER }}/ssh-project:cache + cache-to: type=gha,mode=max,ref=ghcr.io/${{ env.REPO_OWNER }}/ssh-project:cache - name: Notify via ntfy run: | diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dffb4d2d..116bbfe3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,9 +4,9 @@