Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

FSPT-157: archival notice (#9) #30

FSPT-157: archival notice (#9)

FSPT-157: archival notice (#9) #30

Workflow file for this run

name: Publish Base Image
on: [push, workflow_dispatch]
env:
DOCKER_REGISTRY: ghcr.io
IMAGE_NAME: "fsd-base-dev"
IMAGE_REPO_PATH: "ghcr.io/${{github.repository_owner}}"
jobs:
docker-build:
strategy:
matrix:
flavour: ["flask", "frontend", "db"]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python-flask
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: "Set tags in env"
id: set-tags
run: |
source tags
echo "PYTHON_FLASK_DEV_PYTHON=$PYTHON_FLASK_DEV_PY" >> $GITHUB_ENV
echo "PYTHON_FLASK_DEV_FLASK=$PYTHON_FLASK_DEV_FLASK" >> $GITHUB_ENV
echo "PYTHON_FLASK_DEV_FRONTEND=$PYTHON_FLASK_DEV_JINJA" >> $GITHUB_ENV
echo "PYTHON_FLASK_DEV_DB=$PYTHON_FLASK_DEV_SQL_ALCHEMY" >> $GITHUB_ENV
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{env.IMAGE_REPO_PATH}}/${{env.IMAGE_NAME}}/${{matrix.flavour}}
tags: |
type=sha,format=long
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=${{env.PYTHON_FLASK_DEV_PYTHON}},enable=${{ github.ref == format('refs/heads/{0}', 'main')}}
type=raw,value=${{env.PYTHON_FLASK_DEV_FLASK}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=${{env.PYTHON_FLASK_DEV_FRONTEND}},enable=${{ (github.ref == format('refs/heads/{0}', 'main')) && (matrix.flavour == 'frontend') }}
type=raw,value=${{env.PYTHON_FLASK_DEV_DB}},enable=${{ (github.ref == format('refs/heads/{0}', 'main')) && (matrix.flavour == 'db') }}
type=ref,event=branch
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v4
with:
context: ./python-flask/
tags: ${{ steps.metadata.outputs.tags}}
labels: ${{ steps.metadata.outputs.labels }}
push: true
file: ./python-flask/Dockerfile
target: ${{matrix.flavour}}