Skip to content

Merge pull request #164 from r-anime/updates-2023-10-15 #4

Merge pull request #164 from r-anime/updates-2023-10-15

Merge pull request #164 from r-anime/updates-2023-10-15 #4

Workflow file for this run

name: Build and publish Docker images
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# Build multiple containers; map Dockerfile stages to published image names
strategy:
matrix:
include:
- target-stage: backend
image-name: survey-backend
- target-stage: static
image-name: survey-static
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ matrix.image-name }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
target: ${{ matrix.target-stage }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}