diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a9f53f7..924ab03 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,23 +25,20 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to ghcr + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACTOR: ${{ github.actor }} + run: echo "$TOKEN" | docker login ghcr.io -u "$ACTOR" --password-stdin - - name: Build + push - uses: docker/build-push-action@v6 - with: - context: . - file: deploy/Dockerfile.api - push: true - tags: | - ghcr.io/${{ github.repository_owner }}/food-market-api:latest - ghcr.io/${{ github.repository_owner }}/food-market-api:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build + push api + env: + OWNER: ${{ github.repository_owner }} + SHA: ${{ github.sha }} + run: | + docker build -f deploy/Dockerfile.api -t ghcr.io/$OWNER/food-market-api:$SHA -t ghcr.io/$OWNER/food-market-api:latest . + docker push ghcr.io/$OWNER/food-market-api:$SHA + docker push ghcr.io/$OWNER/food-market-api:latest web: name: Web image @@ -49,20 +46,17 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to ghcr + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + ACTOR: ${{ github.actor }} + run: echo "$TOKEN" | docker login ghcr.io -u "$ACTOR" --password-stdin - - name: Build + push - uses: docker/build-push-action@v6 - with: - context: . - file: deploy/Dockerfile.web - push: true - tags: | - ghcr.io/${{ github.repository_owner }}/food-market-web:latest - ghcr.io/${{ github.repository_owner }}/food-market-web:${{ github.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build + push web + env: + OWNER: ${{ github.repository_owner }} + SHA: ${{ github.sha }} + run: | + docker build -f deploy/Dockerfile.web -t ghcr.io/$OWNER/food-market-web:$SHA -t ghcr.io/$OWNER/food-market-web:latest . + docker push ghcr.io/$OWNER/food-market-web:$SHA + docker push ghcr.io/$OWNER/food-market-web:latest