name: Docker images on: workflow_call: inputs: version: required: true type: string push: required: false type: boolean default: true workflow_dispatch: inputs: version: description: Image tag to build. required: true default: dev push: description: Push images to GHCR. required: true type: boolean default: false permissions: contents: read packages: write jobs: build: name: Build ${{ matrix.name }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: backend image: asp-backend context: ./backend file: ./backend/Dockerfile - name: frontend image: asp-frontend context: ./frontend file: ./frontend/Dockerfile steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - name: Resolve image tags id: tags shell: bash run: | owner="${GITHUB_REPOSITORY_OWNER,,}" repo="${GITHUB_REPOSITORY#*/}" repo="${repo,,}" base="ghcr.io/${owner}/${repo}/${{ matrix.image }}" { echo "tags<> "$GITHUB_OUTPUT" - name: Login to GHCR if: inputs.push uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/build-push-action@v6 with: context: ${{ matrix.context }} file: ${{ matrix.file }} push: ${{ inputs.push }} tags: ${{ steps.tags.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max