-
Notifications
You must be signed in to change notification settings - Fork 10
110 lines (107 loc) · 3.71 KB
/
Copy pathdocker.yml
File metadata and controls
110 lines (107 loc) · 3.71 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
name: Docker
on:
push:
branches:
- dev
- staging
env:
ENVIRONMENT: ${{ github.ref_name == 'dev' && 'prod' || 'staging' }}
IMAGE_NAME: ${{ github.ref_name == 'dev' && 'notangles' || 'notangles-staging' }}
jobs:
build-client:
name: 'Build (Client)'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: client
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
platforms: linux/amd64
file: client/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
CLARITY_PROJECT_ID=${{ secrets.CLARITY_PROJECT_ID }}
GIT_COMMIT=${{ github.sha }}
tags: |
ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-client:${{ github.sha }}
ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-client:latest
labels: ${{ steps.meta.outputs.labels }}
build:
name: 'Build (${{ matrix.component }})'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
component: [server, auto_server]
include:
- component: server
name: backend
- component: auto_server
name: auto-timetabler-server
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: ${{ matrix.component }}
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
platforms: linux/amd64
file: ${{ matrix.component }}/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-${{ matrix.name }}:${{ github.sha }}
ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-${{ matrix.name }}:latest
labels: ${{ steps.meta.outputs.labels }}
deploy:
name: Deploy (CD)
runs-on: ubuntu-latest
needs: [build-client, build]
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
concurrency: production
environment: production
steps:
- name: Dispatch deployment
uses: devsoc-unsw/deployment-dispatch-action@main
with:
deployment-dispatcher-app-id: ${{ vars.DEPLOYMENT_DISPATCHER_APP_ID }}
deployment-dispatcher-app-private-key: ${{ secrets.DEPLOYMENT_DISPATCHER_APP_PRIVATE_KEY }}
updates: |
ghcr.io/devsoc-unsw/notangles-client=${{ github.sha }}
ghcr.io/devsoc-unsw/notangles-backend=${{ github.sha }}
ghcr.io/devsoc-unsw/notangles-auto-timetabler-server=${{ github.sha }}