build: include annotations in the multi-arch images #364
Workflow file for this run
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 Image CI | |
on: | |
push: | |
branches-ignore: | |
- renovate/** | |
tags: | |
- '*' | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
name: Build, stable, ${{ matrix.architecture }} | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Configure Docker build | |
run: .github/bin/get-buildx-args | |
- name: Build the Docker image | |
run: .github/bin/docker-build | |
buildx: | |
runs-on: ubuntu-22.04 | |
name: Build, stable, ${{ matrix.architecture }} | |
strategy: | |
matrix: | |
architecture: | |
- linux/arm64 | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ matrix.architecture }} | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Configure Docker build | |
run: .github/bin/get-buildx-args | |
- name: Build the Docker image | |
run: .github/bin/docker-build | |
test: | |
runs-on: ubuntu-22.04 | |
name: Test, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
run: | | |
cd docker-compose | |
./test-generate | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: Run tests | |
run: | | |
cd docker-compose | |
./test-tests | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
test-basic: | |
runs-on: ubuntu-22.04 | |
name: Test basic, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
run: | | |
cd docker-compose | |
./test-generate | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: List Python packages | |
run: | | |
cd docker-compose | |
./test-pip | |
- name: Inspect container | |
run: | | |
cd docker-compose | |
./test-inspect | |
- name: Check service is running | |
run: | | |
cd docker-compose | |
./test-online | |
- name: Check service health status | |
run: | | |
cd docker-compose | |
./test-health | |
- name: Run Django Checks | |
run: | | |
cd docker-compose | |
./test-checks | |
- name: Verify supervisor | |
run: | | |
cd docker-compose | |
./test-supervisor | |
- name: Test admin creation | |
run: | | |
cd docker-compose | |
./test-admin | |
- name: Test commands | |
run: | | |
cd docker-compose | |
./test-commands | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
test-novolume: | |
runs-on: ubuntu-22.04 | |
name: Test novolume, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
run: | | |
cd docker-compose | |
./test-generate 8080 http read-write | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: List Python packages | |
run: | | |
cd docker-compose | |
./test-pip | |
- name: Inspect container | |
run: | | |
cd docker-compose | |
./test-inspect | |
- name: Check service is running | |
run: | | |
cd docker-compose | |
./test-online | |
- name: Check service health status | |
run: | | |
cd docker-compose | |
./test-health | |
- name: Run Django Checks | |
run: | | |
cd docker-compose | |
./test-checks | |
- name: Verify supervisor | |
run: | | |
cd docker-compose | |
./test-supervisor | |
- name: Test admin creation | |
run: | | |
cd docker-compose | |
./test-admin | |
- name: Test commands | |
run: | | |
cd docker-compose | |
./test-commands | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
test-saml: | |
runs-on: ubuntu-22.04 | |
name: Test SAML, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
env: | |
TEST_EXTRA_ENV: 'WEBLATE_SAML_IDP_URL: https://example.com/idp' | |
run: | | |
cd docker-compose | |
./test-generate | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: List Python packages | |
run: | | |
cd docker-compose | |
./test-pip | |
- name: Inspect container | |
run: | | |
cd docker-compose | |
./test-inspect | |
- name: Check service is running | |
run: | | |
cd docker-compose | |
./test-online | |
- name: Check service health status | |
run: | | |
cd docker-compose | |
./test-health | |
- name: Run Django Checks | |
run: | | |
cd docker-compose | |
./test-checks | |
- name: Verify supervisor | |
run: | | |
cd docker-compose | |
./test-supervisor | |
- name: Test admin creation | |
run: | | |
cd docker-compose | |
./test-admin | |
- name: Verify SAML certificate | |
run: | | |
cd docker-compose | |
./test-saml | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
test-split: | |
runs-on: ubuntu-22.04 | |
name: Test split, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
run: | | |
cd docker-compose | |
./test-generate 8080 http split | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: List Python packages | |
run: | | |
cd docker-compose | |
./test-pip | |
- name: Inspect container | |
run: | | |
cd docker-compose | |
./test-inspect | |
- name: Check service is running | |
run: | | |
cd docker-compose | |
./test-online | |
- name: Check service health status | |
run: | | |
cd docker-compose | |
./test-health | |
- name: Run Django Checks | |
run: | | |
cd docker-compose | |
./test-checks | |
- name: Verify supervisor | |
run: | | |
cd docker-compose | |
./test-supervisor | |
- name: Test admin creation | |
run: | | |
cd docker-compose | |
./test-admin | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
test-ssl: | |
runs-on: ubuntu-22.04 | |
name: Test SSL, stable, ${{ matrix.architecture }} | |
needs: [build] | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
COMPOSE_PROJECT_NAME: wl | |
PYTHONUNBUFFERED: 1 | |
TEST_CONTAINER: weblate/weblate:test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Generate configuration | |
run: | | |
cd docker-compose | |
./test-generate 4443 https | |
- name: Generate SSL certificate | |
run: | | |
cd docker-compose | |
docker-compose up --no-start | |
VOLUMEPATH=$(docker volume inspect -f '{{.Mountpoint}}' wl_weblate-data) | |
sudo mkdir -p $VOLUMEPATH/ssl | |
sudo openssl req -x509 -nodes -days 365 -subj "/CN=localhost" -newkey rsa:2048 -keyout $VOLUMEPATH/ssl/privkey.pem -out $VOLUMEPATH/ssl/fullchain.pem | |
sudo chown -R 1000:1000 $VOLUMEPATH/ssl | |
- name: Startup container | |
run: | | |
cd docker-compose | |
./test-boot | |
- name: List Python packages | |
run: | | |
cd docker-compose | |
./test-pip | |
- name: Inspect container | |
run: | | |
cd docker-compose | |
./test-inspect | |
- name: Check service is running | |
run: | | |
cd docker-compose | |
./test-online | |
- name: Check service health status | |
run: | | |
cd docker-compose | |
./test-health | |
- name: Run Django Checks | |
run: | | |
cd docker-compose | |
./test-checks | |
- name: Verify supervisor | |
run: | | |
cd docker-compose | |
./test-supervisor | |
- name: Test admin creation | |
run: | | |
cd docker-compose | |
./test-admin | |
- name: Display logs | |
if: always() | |
run: | | |
cd docker-compose | |
./test-logs | |
- name: Shutdown service | |
run: | | |
cd docker-compose | |
./test-stop | |
anchore: | |
runs-on: ubuntu-22.04 | |
name: Anchore Container Scan, ${{ matrix.architecture }} | |
needs: | |
- build | |
permissions: | |
security-events: write | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Anchore scan action | |
uses: anchore/scan-action@v3 | |
with: | |
image: weblate/weblate:test | |
fail-build: false | |
severity-cutoff: high | |
- name: Upload Anchore Scan Report | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: results.sarif | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Anchore scan SARIF | |
path: results.sarif | |
trivy: | |
runs-on: ubuntu-22.04 | |
name: Trivy Container Scan, ${{ matrix.architecture }} | |
needs: | |
- build | |
permissions: | |
security-events: write | |
strategy: | |
matrix: | |
architecture: [linux/amd64] | |
env: | |
MATRIX_ARCHITECTURE: ${{ matrix.architecture }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache/${{ matrix.architecture }} | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.architecture }} | |
- name: Build the Docker image | |
run: .github/bin/docker-build load | |
- name: List Docker images | |
run: docker image ls --all | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/[email protected] | |
with: | |
image-ref: weblate/weblate:test | |
format: template | |
template: '@/contrib/sarif.tpl' | |
output: trivy-results.sarif | |
severity: CRITICAL,HIGH | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: trivy-results.sarif | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Trivy scan SARIF | |
path: trivy-results.sarif | |
push_dockerhub: | |
runs-on: ubuntu-22.04 | |
name: Publish to Docker Hub, stable | |
needs: | |
- test | |
- test-basic | |
- test-saml | |
- test-split | |
- test-ssl | |
- buildx | |
- anchore | |
- trivy | |
if: ${{ (startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main')) && github.repository == 'WeblateOrg/docker' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache-arm64 | |
with: | |
path: /tmp/.buildx-cache/linux/arm64 | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-linux/arm64 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache-amd64 | |
with: | |
path: /tmp/.buildx-cache/linux/amd64 | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-linux/amd64 | |
- name: DockerHub login | |
run: echo "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" | docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
- name: Configure Docker build | |
run: .github/bin/get-buildx-args publish | |
- name: Publish the Docker images | |
run: .github/bin/docker-build publish | |
push_github: | |
runs-on: ubuntu-22.04 | |
name: Publish to GitHub, stable | |
permissions: | |
packages: write | |
needs: | |
- test | |
- test-basic | |
- test-saml | |
- test-split | |
- test-ssl | |
- buildx | |
- anchore | |
- trivy | |
if: ${{ (startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main')) && github.repository == 'WeblateOrg/docker' }} | |
env: | |
DOCKER_IMAGE: ghcr.io/weblateorg/weblate | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
with: | |
# renovate: datasource=github-releases depName=docker/buildx | |
version: v0.12.0 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache-arm64 | |
with: | |
path: /tmp/.buildx-cache/linux/arm64 | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-linux/arm64 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
id: cache-amd64 | |
with: | |
path: /tmp/.buildx-cache/linux/amd64 | |
key: ${{ runner.os }}-buildx-${{ github.sha }}-linux/amd64 | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name != 'pull_request'}} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure Docker build | |
run: .github/bin/get-buildx-args publish | |
- name: Publish the Docker images | |
run: .github/bin/docker-build publish |