Log in to GHCR #2
  
    
      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: build-docker | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Useful variables | |
| id: setvars | |
| # ghcr.io namespaces must be lower case, but there's no native way | |
| # in the GitHub Actions expression language to convert string case, | |
| # so we have to do it ourselves in a script. | |
| run: echo "repoowner=${{ github.repository_owner }}" | tr 'A-Z' 'a-z' >> "$GITHUB_OUTPUT" | |
| - | |
| name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - | |
| name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| - | |
| name: Build | |
| uses: docker/bake-action@v6 | |
| env: | |
| PROD: "true" | |
| DBBR_REGISTRY: ghcr.io/${{ steps.setvars.outputs.repoowner }}/ | |
| with: | |
| files: | | |
| ./docker-bake.hcl | |
| cwd://${{ steps.meta.outputs.bake-file-labels }} | |
| push: true |