@@ -3,7 +3,7 @@ name: Build & Push Docker Images to GHCR
33on :
44 push :
55 branches :
6- - " ** "
6+ - main
77 workflow_dispatch :
88
99permissions :
@@ -35,11 +35,11 @@ jobs:
3535 BRANCH_LOWER="${GITHUB_REF_NAME,,}"
3636
3737 if [ "$BRANCH_LOWER" = "main" ]; then
38- echo "TAGS =ghcr.io/$REPO_LOWER/app:latest,ghcr.io/$REPO_LOWER/app:$GITHUB_SHA" >> $GITHUB_OUTPUT
38+ echo "TAGS_APP =ghcr.io/$REPO_LOWER/app:latest,ghcr.io/$REPO_LOWER/app:$GITHUB_SHA" >> $GITHUB_OUTPUT
3939 echo "TAGS_API=ghcr.io/$REPO_LOWER/api:latest,ghcr.io/$REPO_LOWER/api:$GITHUB_SHA" >> $GITHUB_OUTPUT
4040 echo "TAGS_STRAPI=ghcr.io/$REPO_LOWER/strapi:latest,ghcr.io/$REPO_LOWER/strapi:$GITHUB_SHA" >> $GITHUB_OUTPUT
4141 else
42- echo "TAGS =ghcr.io/$REPO_LOWER/app:$BRANCH_LOWER,ghcr.io/$REPO_LOWER/app:$GITHUB_SHA" >> $GITHUB_OUTPUT
42+ echo "TAGS_APP =ghcr.io/$REPO_LOWER/app:$BRANCH_LOWER,ghcr.io/$REPO_LOWER/app:$GITHUB_SHA" >> $GITHUB_OUTPUT
4343 echo "TAGS_API=ghcr.io/$REPO_LOWER/api:$BRANCH_LOWER,ghcr.io/$REPO_LOWER/api:$GITHUB_SHA" >> $GITHUB_OUTPUT
4444 echo "TAGS_STRAPI=ghcr.io/$REPO_LOWER/strapi:$BRANCH_LOWER,ghcr.io/$REPO_LOWER/strapi:$GITHUB_SHA" >> $GITHUB_OUTPUT
4545 fi
@@ -48,22 +48,28 @@ jobs:
4848 uses : docker/build-push-action@v5
4949 with :
5050 context : ./app
51- push : true
52- tags : ${{ steps.tags.outputs.TAGS }}
5351 file : ./app/Dockerfile
52+ push : true
53+ tags : ${{ steps.tags.outputs.TAGS_APP }}
54+ cache-from : type=registry,ref=ghcr.io/${{ github.repository }}/app:latest
55+ cache-to : type=inline
5456
5557 - name : Build & Push API
5658 uses : docker/build-push-action@v5
5759 with :
5860 context : ./api
61+ file : ./api/Dockerfile
5962 push : true
6063 tags : ${{ steps.tags.outputs.TAGS_API }}
61- file : ./api/Dockerfile
64+ cache-from : type=registry,ref=ghcr.io/${{ github.repository }}/api:latest
65+ cache-to : type=inline
6266
6367 - name : Build & Push Strapi
6468 uses : docker/build-push-action@v5
6569 with :
6670 context : ./strapi
71+ file : ./strapi/Dockerfile
6772 push : true
6873 tags : ${{ steps.tags.outputs.TAGS_STRAPI }}
69- file : ./strapi/Dockerfile
74+ cache-from : type=registry,ref=ghcr.io/${{ github.repository }}/strapi:latest
75+ cache-to : type=inline
0 commit comments