-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (104 loc) · 4.18 KB
/
Copy pathdocker.yml
File metadata and controls
119 lines (104 loc) · 4.18 KB
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
# SPDX-FileCopyrightText: 2023 HH Partners
#
# SPDX-License-Identifier: MIT
name: Build and publish Docker image on Docker Hub and GitHub Packages
on:
push:
branches:
- main
- worker-deployment
- do-197-env-files-should-be-loaded-in-scripts-not-in-code
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata for Worker
id: meta-worker
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/worker
ghcr.io/${{ github.repository }}/worker
tags: |
type=sha
type=raw,value=latest
- name: Build and push Worker Docker image
uses: docker/build-push-action@v6
continue-on-error: false
with:
context: .
file: "Worker.Dockerfile"
push: true
tags: ${{ steps.meta-worker.outputs.tags }}
labels: ${{ steps.meta-worker.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Docker metadata for API
id: meta-api
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/api
ghcr.io/${{ github.repository }}/api
tags: |
type=sha
type=raw,value=latest
- name: Build and push API Docker image
uses: docker/build-push-action@v6
continue-on-error: false
with:
context: .
file: "API.Dockerfile"
push: true
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Docker metadata for Clearance UI
id: meta-clearance-ui
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/clearance-ui
ghcr.io/${{ github.repository }}/clearance-ui
tags: |
type=sha
type=raw,value=latest
- name: Build and push API Docker image
uses: docker/build-push-action@v6
continue-on-error: false
with:
build-args: |
NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }}
context: .
file: "UI.Dockerfile"
push: true
tags: ${{ steps.meta-clearance-ui.outputs.tags }}
labels: ${{ steps.meta-clearance-ui.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache