-
Notifications
You must be signed in to change notification settings - Fork 4
187 lines (178 loc) · 5.97 KB
/
docker.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: SKEMA docker
on:
push:
branches: [main]
tags:
- "**"
pull_request:
branches: [main]
release:
types: [published]
# builds and publishes docker images for the default branch.
# images are tagged with short commit hash, latest, and any tags.
jobs:
# Determine value for app version
app_version:
name: "Determine app version"
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.app_version.outputs.app_version }}
commit: ${{ steps.app_version.outputs.commit }}
steps:
- name: Set APP_VERSION output
id: app_version
run: |
echo "app_version=${{github.ref_name}}"
if [ -z "${app_version}" ]; then
app_version=${{github.sha}}
echo "app_version=${app_version}"
fi
echo "app_version=$app_version" >> "$GITHUB_OUTPUT"
echo "commit=${{github.sha}}" >> "$GITHUB_OUTPUT"
echo "app_version=$app_version"
echo "commit=${{github.sha}}"
python:
name: "docker image for python components"
needs: [app_version]
runs-on: ubuntu-latest
steps:
# Setup docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# for multi-arch builds (ex. ARM 64)
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# - name: Prepare buildx builder
# run: |
# docker buildx create --use --name "multiarch-builder" --platform linux/amd64,linux/arm64 --driver "docker-container"
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
# Checkout code
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.LUM_ASKEM_DOCKERHUB_USERNAME }}
password: ${{ secrets.LUM_ASKEM_DOCKERHUB_TOKEN }}
- name: "Free disk space"
run: |
sudo apt-get update
sudo apt clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
########################################
# lumai/askem-skema-py (img2mml, isa, etc)
########################################
- name: Tags for image
id: tags
# see https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: |
lumai/askem-skema-py
lumai/askem-skema-img2mml
tags: |
# latest
type=raw,value=latest
# version
type=semver,pattern={{version}}
# other tags
type=ref,event=tag
# short commit hash
type=sha
- name: Build and push image
# see https://github.com/docker/build-push-action
uses: docker/build-push-action@v5
with:
context: .
file: "Dockerfile.skema-py"
platforms: linux/amd64
#platforms: linux/amd64,linux/arm64
no-cache: true
pull: true
push: ${{ github.event_name != 'pull_request' }}
# references `tags` step in steps for current job
tags: ${{ steps.tags.outputs.tags }}
build-args: |
#APP_VERSION=${{needs.app_version.outputs.app_version}}
APP_VERSION=${{needs.app_version.outputs.commit}}
rust:
name: "docker image for rust components"
needs: [app_version]
runs-on: ubuntu-latest
steps:
# Setup docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# for multi-arch builds (ex. ARM 64)
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# - name: Prepare buildx builder
# run: |
# docker buildx create --use --name "multiarch-builder" --platform linux/amd64,linux/arm64 --driver "docker-container"
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
# Checkout code
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.LUM_ASKEM_DOCKERHUB_USERNAME }}
password: ${{ secrets.LUM_ASKEM_DOCKERHUB_TOKEN }}
- name: "Free disk space"
run: |
sudo apt clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
########################################
# lumai/askem-skema-rs
########################################
- name: Tags for image
id: tags
# see https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: lumai/askem-skema-rs
tags: |
# latest
type=raw,value=latest
# version
type=semver,pattern={{version}}
# other tags
type=ref,event=tag
# short commit hash
type=sha
- name: Build and push image
# see https://github.com/docker/build-push-action
uses: docker/build-push-action@v5
with:
context: .
file: "Dockerfile.skema-rs"
platforms: linux/amd64
#platforms: linux/amd64,linux/arm64
no-cache: true
pull: true
push: ${{ github.event_name != 'pull_request' }}
# references `tags` step in steps for current job
tags: ${{ steps.tags.outputs.tags }}
build-args: |
#APP_VERSION=${{needs.app_version.outputs.app_version}}
APP_VERSION=${{needs.app_version.outputs.commit}}