Skip to content

Docker

Docker #278

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
# run every Wednesday
- cron: '31 23 * * 2'
push:
branches:
- main
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: peterstadler/existdb
jobs:
build:
name: build the Docker images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- IMAGE_TAG: |
6
6.3
6.3.0
latest
EXIST_VERSION: "6.2.0"
EXIST_URL: https://github.com/eXist-db/exist/releases/download/eXist-6.3.0/exist-installer-6.3.0.jar
SAXON_JAR: /opt/exist/lib/Saxon-HE-9.9.1-8.jar
- IMAGE_TAG: |
6.2
6.2.0
EXIST_VERSION: "6.2.0"
EXIST_URL: https://github.com/eXist-db/exist/releases/download/eXist-6.2.0/exist-installer-6.2.0.jar
SAXON_JAR: /opt/exist/lib/Saxon-HE-9.9.1-8.jar
- IMAGE_TAG: |
5
5.5
5.5.2
EXIST_VERSION: "5.5.2"
EXIST_URL: https://github.com/eXist-db/exist/releases/download/eXist-5.5.2/exist-installer-5.5.2.jar
SAXON_JAR: /opt/exist/lib/Saxon-HE-9.9.1-8.jar
- IMAGE_TAG: |
4
4.11
4.11.2
EXIST_VERSION: "4.11.2"
EXIST_URL: https://github.com/eXist-db/exist/releases/download/eXist-4.11.2/eXist-db-setup-4.11.2.jar
SAXON_JAR: /opt/exist/lib/endorsed/Saxon-HE-9.6.0-7.jar
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PETERS_GITHUB_TOKEN }}
# Login against DockerHub registry except on PR
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.PETERS_DOCKERHUB_USERNAME }}
password: ${{ secrets.PETERS_DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ secrets.PETERS_DOCKERHUB_USERNAME }}/existdb
tags: ${{ matrix.IMAGE_TAG }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
build-args: |
VERSION=${{ matrix.EXIST_VERSION }}
EXIST_URL=${{ matrix.EXIST_URL }}
SAXON_JAR=${{ matrix.SAXON_JAR }}
push: ${{ github.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
clean:
name: remove untagged images from Github package registry
needs: build
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: ghcr.io cleanup action
uses: dataaxiom/ghcr-cleanup-action@v1
with:
package: existdb
delete-untagged: true
dry-run: false
validate: true
older-than: 2 weeks
token: ${{ secrets.GITHUB_TOKEN }}