Docker #873
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
name: Docker | |
on: | |
push: | |
branches: | |
- 'master' | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
generate-matrix: | |
name: Generate matrix for Docker build | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Set matrix for build | |
id: set-matrix | |
run: | | |
# FIXME: https://github.com/actions/checkout/issues/290 | |
git fetch --force --tags | |
one="{ \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"develop\", \"tags\": \"chocobozzz/peertube:develop-bookworm\" }" | |
two="{ \"file\": \"./support/docker/production/Dockerfile.bookworm\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube:production-bookworm,chocobozzz/peertube:$(git describe --abbrev=0)-bookworm\" }" | |
three="{ \"file\": \"./support/docker/production/Dockerfile.nginx\", \"ref\": \"master\", \"tags\": \"chocobozzz/peertube-webserver:latest\" }" | |
matrix="[$one,$two,$three]" | |
echo "matrix={\"include\":$matrix}" >> $GITHUB_OUTPUT | |
docker: | |
runs-on: ubuntu-latest | |
needs: generate-matrix | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
fail-fast: false | |
name: ${{ matrix.tags }} | |
steps: | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Checkout develop | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.ref }} | |
- | |
name: Docker build | |
uses: docker/build-push-action@v3 | |
with: | |
context: '.' | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: ${{ matrix.file }} | |
tags: ${{ matrix.tags }} |