-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (72 loc) · 2.79 KB
/
docker-image.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
72
73
74
75
76
77
78
79
name: Docker Image CI
on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
jobs:
build:
name: Build ${{ matrix.image }} Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- app
- parse-server
- ses
steps:
- name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
- name: Extract ${{ matrix.image }} Docker metadata
id: meta
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
with:
images: ${{ env.REGISTRY }}/thm-mni-ii/quick-survey-${{ matrix.image }}
- name: Build and push ${{ matrix.image }} Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
with:
context: ${{ matrix.image }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,scope=${{ github.workflow }}
- name: Extract ${{ matrix.image }} Docker metadata for image with THM colors
id: meta-thm
if: ${{ matrix.image == 'app' }}
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
with:
images: ${{ env.REGISTRY }}/thm-mni-ii/quick-survey-${{ matrix.image }}
flavor: |
suffix=-thm
- name: Build and push ${{ matrix.image }} Docker image with THM colors
if: ${{ matrix.image == 'app' }}
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
with:
context: ${{ matrix.image }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-thm.outputs.tags }}
labels: ${{ steps.meta-thm.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,scope=${{ github.workflow }}
build-args: |
VITE_THEME_PRIMARY=#80ba24
VITE_THEME_SECONDARY=#4a5c66