Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit c650999

Browse files
authored
Move the docker image build to Github Actions (#10416)
it's flaky on circleCI, and having to manage multiple CI providers is painful.
1 parent e009d2e commit c650999

File tree

3 files changed

+73
-78
lines changed

3 files changed

+73
-78
lines changed

.circleci/config.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# GitHub actions workflow which builds and publishes the docker images.
2+
3+
name: Build docker images
4+
5+
on:
6+
push:
7+
tags: ["v*"]
8+
branches: [ master, main ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Set up QEMU
19+
id: qemu
20+
uses: docker/setup-qemu-action@v1
21+
with:
22+
platforms: arm64
23+
24+
- name: Set up Docker Buildx
25+
id: buildx
26+
uses: docker/setup-buildx-action@v1
27+
28+
- name: Inspect builder
29+
run: docker buildx inspect
30+
31+
- name: Log in to DockerHub
32+
uses: docker/login-action@v1
33+
with:
34+
username: ${{ secrets.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKERHUB_TOKEN }}
36+
37+
- name: Calculate docker image tag
38+
id: set-tag
39+
run: |
40+
case "${GITHUB_REF}" in
41+
refs/heads/master|refs/heads/main)
42+
tag=latest
43+
;;
44+
refs/tags/*)
45+
tag=${GITHUB_REF#refs/tags/}
46+
;;
47+
*)
48+
tag=${GITHUB_SHA}
49+
;;
50+
esac
51+
echo "::set-output name=tag::$tag"
52+
53+
# for release builds, we want to get the amd64 image out asap, so first
54+
# we do an amd64-only build, before following up with a multiarch build.
55+
- name: Build and push amd64
56+
uses: docker/build-push-action@v2
57+
if: "${{ startsWith(github.ref, 'refs/tags/v' }}"
58+
with:
59+
push: true
60+
labels: "gitsha1=${{ github.sha }}"
61+
tags: "matrixdotorg/synapse:${{ steps.set-tag.outputs.tag }}"
62+
file: "docker/Dockerfile"
63+
platforms: linux/amd64
64+
65+
- name: Build and push all platforms
66+
uses: docker/build-push-action@v2
67+
with:
68+
push: true
69+
labels: "gitsha1=${{ github.sha }}"
70+
tags: "matrixdotorg/synapse:${{ steps.set-tag.outputs.tag }}"
71+
file: "docker/Dockerfile"
72+
platforms: linux/amd64,linux/arm64

changelog.d/10416.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move docker image build to Github Actions.

0 commit comments

Comments
 (0)