Skip to content

Commit

Permalink
Publish docker images via GHA (#1134)
Browse files Browse the repository at this point in the history
Co-authored-by: reivilibre <[email protected]>
  • Loading branch information
David Robertson and reivilibre authored Sep 15, 2021
1 parent e0b951d commit 888762f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 33 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# GitHub actions workflow which builds and publishes the docker images.

name: Build and deploy docker images

on:
push:
branches: [ develop ]
workflow_dispatch:

permissions:
contents: read

jobs:
build-sytest-images:
name: "Build sytest:${{ matrix.tag }}"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- base_image: ubuntu:bionic
tag: bionic
- base_image: debian:buster
tag: buster
- base_image: debian:testing
tag: testing
steps:
- 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: Build and push
uses: docker/build-push-action@v2
with:
pull: true
push: true
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: bionic
dockerfile: synapse
tags: "matrixdotorg/sytest-synapse:bionic"
- sytest_image_tag: buster
dockerfile: synapse
tags: "matrixdotorg/sytest-synapse:buster"
- sytest_image_tag: testing
dockerfile: synapse
tags: "matrixdotorg/sytest-synapse:testing"
- sytest_image_tag: buster
dockerfile: dendrite
tags: "matrixdotorg/sytest-dendrite:go113,matrixdotorg/sytest-dendrite:latest"

steps:
- 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: Build and push
uses: docker/build-push-action@v2
with:
pull: true
push: true
labels: "gitsha1=${{ github.sha }}"
file: docker/base.Dockerfile
build-args: "SYTEST_IMAGE_TAG=${{ matrix.base_image }}"
tags: ${{ matrix.tags }}
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ docker run --rm -it ... matrixdotorg/sytest-synapse:buster tests/20profile-event

## Building the containers

The containers are built by executing `./build.sh`. You will then have to push
them up to Docker Hub with `./push.sh`.
These are automatically built and deployed on the `develop` branch by GitHub Actions.
See `.github/workflows.docker.yml` for the gory details.

## Loading sytest plugins at start

Expand Down
16 changes: 0 additions & 16 deletions docker/build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions docker/push.sh

This file was deleted.

0 comments on commit 888762f

Please sign in to comment.