| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- name: Docker
- on:
- push:
- branches: [ "main" ]
- paths:
- - 'Dockerfile'
- - 'frontend/Dockerfile'
- - 'frontend/**'
- - 'requirements.txt'
- - 'VERSION'
- - '**.py'
- # Allow manual trigger on any branch
- workflow_dispatch:
- inputs:
- branch:
- description: 'Branch to build from'
- required: false
- default: ''
- env:
- REGISTRY: ghcr.io
- jobs:
- build-backend:
- runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
- id-token: write
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Log into registry ${{ env.REGISTRY }}
- uses: docker/login-action@v3
- with:
- registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Extract Docker metadata
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: ${{ env.REGISTRY }}/${{ github.repository }}
- - name: Build and push backend image
- uses: docker/build-push-action@v5
- with:
- context: .
- push: true
- tags: ${{ steps.meta.outputs.tags }}
- labels: ${{ steps.meta.outputs.labels }}
- platforms: linux/amd64,linux/arm64
- cache-from: type=gha,scope=backend
- cache-to: type=gha,mode=max,scope=backend
- build-frontend:
- runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
- id-token: write
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Log into registry ${{ env.REGISTRY }}
- uses: docker/login-action@v3
- with:
- registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Extract Docker metadata
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: ${{ env.REGISTRY }}/${{ github.repository }}-frontend
- - name: Build and push frontend image
- uses: docker/build-push-action@v5
- with:
- context: ./frontend
- file: ./frontend/Dockerfile
- push: true
- tags: ${{ steps.meta.outputs.tags }}
- labels: ${{ steps.meta.outputs.labels }}
- platforms: linux/amd64,linux/arm64
- cache-from: type=gha,scope=frontend
- cache-to: type=gha,mode=max,scope=frontend
|