-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (65 loc) · 2.27 KB
/
workflow-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build and push images to GCR
on:
workflow_call:
secrets:
GCR_PASSWORD:
description: "Password for Github Container Registry"
required: true
inputs:
dockerImageBaseName:
description: "Base image name for docker images"
required: true
type: string
version:
description: "Version to tag"
required: true
type: string
jobs:
publish-docker-images:
env:
DOCKER_IMAGE_BASE_NAME: ${{ inputs.dockerImageBaseName }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- dockerfile: ./src/Digdir.Domain.Dialogporten.WebApi/Dockerfile
imageName: webapi
- dockerfile: ./src/Digdir.Domain.Dialogporten.GraphQL/Dockerfile
imageName: graphql
- dockerfile: ./src/Digdir.Domain.Dialogporten.Service/Dockerfile
imageName: service
- dockerfile: ./src/Digdir.Domain.Dialogporten.ChangeDataCapture/Dockerfile
imageName: cdc
- dockerfile: ./src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundle.dockerfile
imageName: migration-bundle
- dockerfile: ./src/Digdir.Domain.Dialogporten.Janitor/Dockerfile
imageName: janitor
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GCR_PASSWORD }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_BASE_NAME }}${{ matrix.imageName }}
- uses: docker/setup-buildx-action@v3
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
${{ env.DOCKER_IMAGE_BASE_NAME }}${{ matrix.imageName }}:${{ inputs.version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.imageName }}
cache-to: type=gha,mode=max,scope=${{ matrix.imageName }}