Update CI to push Docker images to ghcr.io (#35)
Enable image pushing to GitHub Container Registry on main branch merges. Tags images with both commit SHA and latest. Co-authored-by: Groom Book CTO <cto@groombook.app> Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #35.
This commit is contained in:
committed by
GitHub
parent
4ab5597fd5
commit
1c54c4264d
@@ -69,32 +69,46 @@ jobs:
|
||||
run: pnpm build
|
||||
|
||||
docker:
|
||||
name: Build Docker Images
|
||||
name: Build & Push Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build API image
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push API image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: apps/api/Dockerfile
|
||||
push: false
|
||||
tags: groombook/api:${{ github.sha }}
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/groombook/api:${{ github.sha }}
|
||||
ghcr.io/groombook/api:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build Web image
|
||||
- name: Build and push Web image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: apps/web/Dockerfile
|
||||
push: false
|
||||
tags: groombook/web:${{ github.sha }}
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/groombook/web:${{ github.sha }}
|
||||
ghcr.io/groombook/web:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
Reference in New Issue
Block a user