-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (122 loc) · 4.6 KB
/
docker-hub-merge.yaml
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
133
134
135
136
137
138
139
140
141
142
143
144
name: Deploy to Docker Hub on merge
on:
push:
branches:
- master
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Checkout Processor Tools
uses: actions/checkout@v4
with:
repository: MILO-ML/Processor-Tools
path: preprocessor
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: false
- name: Update package version
run: |
sed -i.bak "s|\"version\": \"[0-9\.]*\"|\"version\": \"${{ steps.gitversion.outputs.semVer }}\"|" package.json
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache UI Dependencies
id: cache_ui
uses: actions/cache@v4
with:
path: ui/node_modules
key: ${{ runner.os }}-ui-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-ui-
- name: Cache Docs Dependencies
id: cache_docs
uses: actions/cache@v4
with:
path: docs/node_modules
key: ${{ runner.os }}-docs-${{ hashFiles('docs/package-lock.json') }}
restore-keys: |
${{ runner.os }}-docs-
- name: Cache Preprocessor Dependencies
id: cache_pp
uses: actions/cache@v4
with:
path: preprocessor/node_modules
key: ${{ runner.os }}-preprocessor-${{ hashFiles('preprocessor/package-lock.json') }}
restore-keys: |
${{ runner.os }}-preprocessor-
- name: Install UI dependencies
if: steps.cache_ui.outputs.cache-hit != 'true'
run: npm --prefix ui install
- name: Install Docs dependencies
if: steps.cache_docs.outputs.cache-hit != 'true'
run: npm --prefix docs install
- name: Install Preprocessor dependencies
if: steps.cache_pp.outputs.cache-hit != 'true'
run: npm --prefix preprocessor install
- name: Build AutoML UI
run: npm --prefix ui run build-docker
- name: Build Documentation
run: NODE_OPTIONS=--openssl-legacy-provider npm --prefix docs run build
- name: Build Preprocessor UI
run: NODE_OPTIONS=--openssl-legacy-provider npm --prefix preprocessor run milo-build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Tag
run: |
if [ "${GITHUB_REF##*/}" == "master" ]; then
echo "TAG=latest" >> $GITHUB_ENV
else
echo "TAG=beta" >> $GITHUB_ENV
fi
- name: Build All-in-One Docker Image
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--cache-from=type=registry,ref=${{ env.ACR_ADDRESS }}/${{ env.CACHE_REPOSITORY }} \
--cache-to=type=registry,ref=${{ env.ACR_ADDRESS }}/${{ env.CACHE_REPOSITORY }},mode=max \
--target aio \
-t ${{ env.ACR_ADDRESS }}/aio:${{ steps.gitversion.outputs.semVer }} \
-t ${{ env.ACR_ADDRESS }}/aio:${{ env.TAG }} \
--push \
.
env:
ACR_ADDRESS: ${{ secrets.ACR_ADDRESS }}
CACHE_REPOSITORY: build-cache
- name: Build API Docker Image
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--cache-from=type=registry,ref=${{ env.ACR_ADDRESS }}/${{ env.CACHE_REPOSITORY }} \
--target api \
-t ${{ env.ACR_ADDRESS }}/api:${{ steps.gitversion.outputs.semVer }} \
-t ${{ env.ACR_ADDRESS }}/api:${{ env.TAG }} \
--push \
.
env:
ACR_ADDRESS: ${{ secrets.ACR_ADDRESS }}
CACHE_REPOSITORY: build-cache
- name: Build Worker Docker Image
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--cache-from=type=registry,ref=${{ env.ACR_ADDRESS }}/${{ env.CACHE_REPOSITORY }} \
--target worker \
-t ${{ env.ACR_ADDRESS }}/worker:${{ steps.gitversion.outputs.semVer }} \
-t ${{ env.ACR_ADDRESS }}/worker:${{ env.TAG }} \
--push \
.
env:
ACR_ADDRESS: ${{ secrets.ACR_ADDRESS }}
CACHE_REPOSITORY: build-cache