Docker Build #20
This file contains 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 Build | |
on: | |
workflow_run: | |
workflows: ["Linting Checks"] | |
branches: [master] | |
types: [completed] | |
jobs: | |
docker-build-frontend: | |
if: > | |
github.event.workflow_run.conclusion == 'success' && | |
github.event.workflow_run.head_branch == 'master' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
environment: production | |
env: | |
FRONTEND_IMAGE: ghcr.io/${{ github.repository_owner }}/navigator-frontend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
- name: Login in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & push frontend | |
uses: docker/build-push-action@v6 | |
with: | |
context: frontend | |
tags: | | |
${{ env.FRONTEND_IMAGE }}:${{ github.sha }} | |
${{ env.FRONTEND_IMAGE }}:latest | |
push: true | |
docker-build-backend: | |
if: > | |
github.event.workflow_run.conclusion == 'success' && | |
github.event.workflow_run.head_branch == 'master' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
environment: production | |
env: | |
BACKEND_IMAGE: ghcr.io/${{ github.repository_owner }}/navigator-backend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build & push backend | |
uses: docker/build-push-action@v6 | |
with: | |
context: backend | |
tags: | | |
${{ env.BACKEND_IMAGE }}:${{ github.sha }} | |
${{ env.BACKEND_IMAGE }}:latest | |
push: true |