@@ -161,42 +161,68 @@ jobs:
161
161
env :
162
162
DOCKERHUB_ORG : gospatial
163
163
DOCKERHUB_REPO : tegola
164
+ BUILD_ARGS : |
165
+ BUILDPKG=${BUILD_PKG}
166
+ VER=${VERSION}
167
+ BRANCH=${GIT_BRANCH}
168
+ REVISION=${GIT_REVISION}
164
169
165
170
steps :
166
171
- name : Check out code
167
172
uses : actions/checkout@v3
168
173
174
+ - name : Set up QEMU
175
+ uses : docker/setup-qemu-action@v2
176
+
177
+ - name : Set up Docker Buildx
178
+ uses : docker/setup-buildx-action@v2
179
+
180
+ - name : Login to Docker Hub
181
+ uses : docker/login-action@v2
182
+ with :
183
+ username : ${{ secrets.DOCKERHUB_USER }}
184
+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
185
+
169
186
- name : Setup env
170
187
uses : ./.github/actions/tegola-setup-env
171
188
with :
172
189
ui : true
173
190
174
- - name : Build and tag Docker container
191
+ # Buildx can only output single-platform result image to docker
192
+ # so for testing purposes we are building only for linux/amd64
193
+ # Later when we publish the image we build for linux/amd64 and linux/arm64
194
+ # Note that linux/amd64 is cached, so when we build images for publishing
195
+ # we are not rebuilding linux/amd64
196
+ - name : Build docker image for testing
197
+ uses : docker/build-push-action@v4
198
+ with :
199
+ context : .
200
+ load : true
201
+ platforms : linux/amd64
202
+ build-args : ${{ env.BUILD_ARGS }}
203
+ tags : ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}
204
+
205
+ - name : Test image build
175
206
run : |
176
- docker build -t tegola --build-arg BUILDPKG=${BUILD_PKG} --build-arg VER=${VERSION} --build-arg BRANCH=${GIT_BRANCH} --build-arg REVISION=${GIT_REVISION} .
177
- docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION}
178
- docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest
179
- docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge
180
- docker run --rm tegola version
207
+ docker run --rm ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION} version
181
208
182
209
- name : Publish Docker edge container
183
210
if : github.ref == env.DEFAULT_BRANCH_REF
184
- env :
185
- DOCKERHUB_USER : ${{ secrets.DOCKERHUB_USER }}
186
- DOCKERHUB_PASSWORD : ${{ secrets.DOCKERHUB_PASSWORD }}
187
- run : |
188
- echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin
189
- docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge
211
+ uses : docker/build-push-action@v4
212
+ with :
213
+ push : true
214
+ tags : ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:edge
215
+ platforms : linux/amd64,linux/arm64
216
+ build-args : ${{ env.BUILD_ARGS }}
190
217
191
218
- name : Publish Docker container
192
219
if : github.event_name == 'release'
193
- env :
194
- DOCKERHUB_USER : ${{ secrets.DOCKERHUB_USER }}
195
- DOCKERHUB_PASSWORD : ${{ secrets.DOCKERHUB_PASSWORD }}
196
- run : |
197
- echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin
198
- docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION}
199
- docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest
220
+ uses : docker/build-push-action@v4
221
+ with :
222
+ push : true
223
+ tags : ${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }},${{ env.DOCKERHUB_ORG }}/${{ env.DOCKERHUB_REPO }}:latest
224
+ platforms : linux/amd64,linux/arm64
225
+ build-args : ${{ env.BUILD_ARGS }}
200
226
201
227
build_windows :
202
228
name : Build for Windows
0 commit comments