Build and deploy docker images #861
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
# GitHub actions workflow which builds and publishes the docker images. | |
name: Build and deploy docker images | |
on: | |
push: | |
branches: [develop] | |
schedule: | |
- cron: 0 1 * * * # 1am, daily. | |
workflow_dispatch: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-sytest-images: | |
name: "Build sytest:${{ matrix.tag }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- base_image: ubuntu:focal | |
tag: focal | |
- base_image: ubuntu:mantic | |
tag: mantic | |
- base_image: debian:bullseye | |
tag: bullseye | |
- base_image: debian:testing | |
tag: testing | |
steps: | |
- name: Set up QEMU | |
id: QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Inspect builder | |
run: docker buildx inspect | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
pull: true | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
labels: "gitsha1=${{ github.sha }}" | |
file: docker/base.Dockerfile | |
build-args: "BASE_IMAGE=${{ matrix.base_image }}" | |
tags: matrixdotorg/sytest:${{ matrix.tag }} | |
build-dependent-images: | |
needs: build-sytest-images | |
name: "Build sytest-${{ matrix.dockerfile }}:${{ matrix.sytest_image_tag }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- sytest_image_tag: focal | |
dockerfile: synapse | |
tags: "matrixdotorg/sytest-synapse:focal" | |
build_args: "SYTEST_IMAGE_TAG=focal" | |
- sytest_image_tag: mantic | |
dockerfile: synapse | |
tags: "matrixdotorg/sytest-synapse:mantic-3.12" | |
build_args: | | |
SYTEST_IMAGE_TAG=mantic | |
PYTHON_VERSION=python3.12 | |
SYSTEM_PIP_INSTALL_SUFFIX=--break-system-packages | |
- sytest_image_tag: bullseye | |
dockerfile: synapse | |
tags: "matrixdotorg/sytest-synapse:bullseye" | |
build_args: "SYTEST_IMAGE_TAG=bullseye" | |
- sytest_image_tag: testing | |
dockerfile: synapse | |
tags: "matrixdotorg/sytest-synapse:testing" | |
build_args: | | |
SYTEST_IMAGE_TAG=testing | |
SYSTEM_PIP_INSTALL_SUFFIX=--break-system-packages | |
steps: | |
- name: Set up QEMU | |
id: QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Inspect builder | |
run: docker buildx inspect | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
pull: true | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
labels: "gitsha1=${{ github.sha }}" | |
file: docker/${{ matrix.dockerfile }}.Dockerfile | |
build-args: ${{ matrix.build_args }} | |
tags: ${{ matrix.tags }} |