fix: change target #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Bake Build | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: nimendra/fastapi-demo | |
| jobs: | |
| docker: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from tag or fallback | |
| id: version | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "TAG=0.0.1" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Docker Bake (build and push) | |
| uses: docker/bake-action@v6 | |
| with: | |
| push: true | |
| files: | | |
| ./docker-bake.hcl | |
| targets: prod | |
| set: | | |
| *.labels.org.opencontainers.image.revision=${{ github.sha }} | |
| *.cache-from=type=gha | |
| *.cache-to=type=gha,mode=max | |
| *.args.TAG=${{ steps.version.outputs.TAG }} |