-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and push docker images using GitHub Actions (#249)
Co-authored-by: Andrew Morgan <[email protected]>
- Loading branch information
1 parent
6d62a28
commit 6a32774
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# GitHub actions workflow which builds and publishes the docker images. | ||
|
||
name: Build and push docker images | ||
|
||
on: | ||
push: | ||
tags: ["v*"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
id: qemu | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Inspect builder | ||
run: docker buildx inspect | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
|
||
- name: Calculate docker image tags | ||
id: set-tag | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: matrixdotorg/sygnal | ||
tags: | | ||
type=ref,event=tag | ||
# we explicitly check out the repository (and use `context: .` in buildx) | ||
# because we need to preserve the git metadata so that setuptools_scm | ||
# (as part of Sygnal's setup.py) can deduce the package version. | ||
# See: https://github.com/marketplace/actions/build-and-push-docker-images#path-context | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push all platforms | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
labels: "gitsha1=${{ github.sha }}" | ||
tags: "${{ steps.set-tag.outputs.tags }}" | ||
file: "docker/Dockerfile" | ||
platforms: linux/amd64,linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Automatically build the Docker image for each release and push it to Docker Hub using GitHub Actions. |