Merge pull request #136 from amazeeio/dev #78
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: Publish Docker Images | |
on: | |
push: | |
branches: [ dev ] | |
env: | |
REGISTRY: ghcr.io | |
NAMESPACE: ${{ github.repository_owner }} | |
REPO_NAME: ${{ github.event.repository.name }} | |
jobs: | |
build-and-push-backend: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for backend | |
id: meta-backend | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.REPO_NAME }}-backend | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha,prefix={{branch}}- | |
- name: Build and push backend Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta-backend.outputs.tags }} | |
labels: ${{ steps.meta-backend.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-and-push-frontend: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for frontend | |
id: meta-frontend | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.REPO_NAME }}-frontend | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha,prefix={{branch}}- | |
- name: Build and push frontend Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
tags: ${{ steps.meta-frontend.outputs.tags }} | |
labels: ${{ steps.meta-frontend.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |