availabili.tf/.github/workflows/build.yml

47 lines
1.3 KiB
YAML

name: Build Docker Images
on:
workflow_run:
workflows:
- tests.yml
types:
- completed
workflow_dispatch:
jobs:
build:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
- name: Build Docker image for backend
run: |
cd backend-flask
docker build -t ghcr.io/${OWNER_LC}/availabili-tf-backend-flask:latest .
docker push ghcr.io/${OWNER_LC}/availabili-tf-backend-flask:latest
- name: Build Docker image for frontend
run: |
cd availabili.tf
docker build -t ghcr.io/${OWNER_LC}/availabili-tf-frontend:latest -f Dockerfile.prod .
docker push ghcr.io/${OWNER_LC}/availabili-tf-frontend:latest