Skip to content

Build and Push All The Docker Images #67

Build and Push All The Docker Images

Build and Push All The Docker Images #67

Workflow file for this run

name: Build and Push All The Docker Images
on:
workflow_dispatch: # Manually trigger the workflow
inputs:
tags:
description: "Tag (used as VITE_FMP_VERSION)"
required: true
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
folder: [alloy-api, backend, frontend, limboole-api, nuxmv-api, spectra-api, z3-api]
include:
- folder: alloy-api
image_name: ghcr.io/${{ github.repository }}-alloy-api
- folder: backend
image_name: ghcr.io/${{ github.repository }}-backend
- folder: frontend
image_name: ghcr.io/${{ github.repository }}-frontend
- folder: limboole-api
image_name: ghcr.io/${{ github.repository }}-limboole-api
- folder: nuxmv-api
image_name: ghcr.io/${{ github.repository }}-nuxmv-api
- folder: spectra-api
image_name: ghcr.io/${{ github.repository }}-spectra-api
- folder: z3-api
image_name: ghcr.io/${{ github.repository }}-z3-api
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image_name }}
tags: |
type=edge,branch=main
type=semver,pattern={{version}}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Extract VITE_FMP_VERSION
id: extract_version
run: |
if [ -n "${{ github.event.inputs.tags }}" ]; then
echo "VITE_FMP_VERSION=${{ github.event.inputs.tags }}" >> $GITHUB_ENV
else
echo "VITE_FMP_VERSION=$(echo $DOCKER_METADATA_OUTPUT_VERSION)" >> $GITHUB_ENV
fi
- name: Determine Tags
id: determine-tags
run: |
if [ -n "${{ github.event.inputs.tags }}" ]; then
echo "TAGS=${{ matrix.image_name }}:${{ github.event.inputs.tags }}" >> $GITHUB_ENV
else
echo "TAGS=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ',')" >> $GITHUB_ENV
fi
- name: Debug Tags
run: |
echo "Resolved tags: ${{ env.TAGS }}"
- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.folder }}
file: ./${{ matrix.folder }}/Dockerfile
tags: ${{ env.TAGS }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
build-args: |
VITE_FMP_API_URL=https://play.formal-methods.net/api
VITE_FMP_VERSION=${{ env.VITE_FMP_VERSION }}