Build Stack Images #11
This file contains 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: Build Stack Images | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Docker image tag' | |
required: false | |
default: 'latest' | |
type: string | |
stack: | |
description: 'Which stack to build (leave empty to build all)' | |
required: false | |
type: choice | |
options: | |
- all | |
- angular-vanilla | |
- nextjs-shadcn | |
- nextjs-vanilla | |
- nextjs-p5 | |
- nextjs-pixi | |
default: 'all' | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: ${{ | |
inputs.stack == 'all' | |
&& fromJSON('[ | |
{"name":"angular-vanilla","dockerfile":"images/AngularVanillaDockerFile"}, | |
{"name":"nextjs-shadcn","dockerfile":"images/NextjsShadcnDockerFile"}, | |
{"name":"nextjs-vanilla","dockerfile":"images/NextjsVanillaDockerFile"}, | |
{"name":"nextjs-p5","dockerfile":"images/NextjsP5DockerFile"}, | |
{"name":"nextjs-pixi","dockerfile":"images/NextjsPixiDockerFile"} | |
]') | |
|| fromJSON(format('[{"name":"%s","dockerfile":"images/%sDockerFile"}]', | |
inputs.stack, | |
inputs.stack == 'angular-vanilla' && 'AngularVanilla' | |
|| inputs.stack == 'nextjs-shadcn' && 'NextjsShadcn' | |
|| inputs.stack == 'nextjs-vanilla' && 'NextjsVanilla' | |
|| inputs.stack == 'nextjs-p5' && 'NextjsP5' | |
|| inputs.stack == 'nextjs-pixi' && 'NextjsPixi' | |
)) | |
}} | |
name: Build ${{ matrix.include.name }} Image | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }}-pack-${{ matrix.include.name }} | |
tags: | | |
type=raw,value=${{ inputs.tag }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: frontend | |
file: ${{ matrix.include.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |