-
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (111 loc) · 4.17 KB
/
build-images.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: build & push images
on:
release:
types:
- prereleased
- released
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get commit hash
id: version
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build-api:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_REGISTRY_KEY }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push API image
uses: docker/build-push-action@v5
with:
context: .
file: config/api.Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:${{ needs.setup.outputs.version }}
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.API_IMAGE }}:buildcache,mode=max
- name: Image digest
run: echo "API image digest $(doctl registry repository digest-list ${{ vars.API_IMAGE }} --format Tag,Digest --no-header | grep latest)"
build-queue:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_REGISTRY_KEY }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Queue image
uses: docker/build-push-action@v5
with:
context: .
file: config/queue.Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:${{ needs.setup.outputs.version }}
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.QUEUE_IMAGE }}:buildcache,mode=max
- name: Image digest
run: echo "Queue image digest $(doctl registry repository digest-list ${{ vars.QUEUE_IMAGE }} --format Tag,Digest --no-header | grep latest)"
build-ui:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_REGISTRY_KEY }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push UI image
uses: docker/build-push-action@v5
with:
context: .
file: config/ui.Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:latest
${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:${{ needs.setup.outputs.version }}
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ vars.UI_IMAGE }}:buildcache,mode=max
- name: Image digest
run: echo "UI image digest $(doctl registry repository digest-list ${{ vars.UI_IMAGE }} --format Tag,Digest --no-header | grep latest)"