Auto build QGIS server Docker images #772
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: Auto build QGIS server Docker images | |
on: | |
schedule: | |
# runs once a week | |
- cron: '0 6 * * 0' | |
# runs every day | |
# - cron: '0 6 * * *' | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
DEFAULT_UBUNTU_DIST: focal # for the default dist, no suffix to tag | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
jobs: | |
build-nightly: | |
runs-on: ubuntu-latest | |
name: build nightly | |
strategy: | |
fail-fast: false | |
matrix: | |
qgis_type: [ 'desktop', 'server' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gautamkrishnar/keepalive-workflow@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: define tag | |
run: | | |
echo "DOCKER_TAG=$( [[ ${{ matrix.qgis_type }} = 'server' ]] && echo 'qgis-server' || echo 'qgis' )" >> $GITHUB_ENV | |
- id: nightly | |
name: building nightly | |
run: docker build -t opengisch/${{ env.DOCKER_TAG }}:nightly -f ${{ matrix.qgis_type }}.Dockerfile --build-arg repo=ubuntu-nightly . | |
- name: test | |
if: ${{ matrix.qgis_type == 'server' }} | |
run: | | |
docker run -d -v $(pwd)/test/data:/io/data -p 8010:80 --name qgis-server opengisch/qgis-server:nightly | |
docker exec -i qgis-server dpkg -l qgis-server | |
sleep 5 | |
curl -s 'http://localhost:8010/ogc/test_project?service=WMS&request=GetCapabilities' | grep -ivq exception | |
- name: push | |
run: docker push opengisch/${{ env.DOCKER_TAG }}:nightly | |
build: | |
runs-on: ubuntu-latest | |
name: build | |
strategy: | |
fail-fast: false | |
matrix: | |
qgis_type: ['desktop', 'server'] | |
ubuntu_dist: [ 'focal', 'jammy', 'lunar' ] | |
version: ['stable', 'ltr'] | |
steps: | |
- uses: actions/checkout@v4 | |
- id: python_deps | |
run: pip3 install packaging | |
- id: determine | |
name: determine QGIS and Docker versions | |
run : | | |
DOCKER=$(./scripts/get_docker_image_version.py --qgis=${{ matrix.qgis_type }} --dist=${{ matrix.ubuntu_dist }}) | |
QGIS=$(./scripts/get_ubuntu_qgis_package_version.py --qgis=${{ matrix.qgis_type }} --dist ${{ matrix.ubuntu_dist }}) | |
DOCKER_VERSION=$(echo "${DOCKER}" | jq ".${{ matrix.version }}") | |
QGIS_VERSION=$(echo "${QGIS}" | jq ".${{ matrix.version }}") | |
echo "Existing ${{ matrix.version }} docker: ${DOCKER_VERSION}" | |
echo "Available ${{ matrix.version }} QGIS: ${QGIS_VERSION}" | |
WILL_UPDATE=$(python3 -c "from packaging import version; print(1 if version.parse(${DOCKER_VERSION} or '0') < version.parse(${QGIS_VERSION}) else 0)") | |
if [[ ${WILL_UPDATE} == 1 ]]; then | |
echo "--> ${{ matrix.version }} will be updated from ${DOCKER_VERSION} to ${QGIS_VERSION}." | |
else | |
echo "--> ${{ matrix.version }} is up to date (${QGIS_VERSION})." | |
fi | |
echo "will_update=${WILL_UPDATE}" >> $GITHUB_OUTPUT | |
echo "qgis_version=${QGIS_VERSION//\"/}">> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
if: ${{ steps.determine.outputs.will_update == 1 }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: arm64,arm | |
- name: Set up Docker Buildx | |
if: ${{ steps.determine.outputs.will_update == 1 }} | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: ${{ steps.determine.outputs.will_update == 1 }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- id: build | |
if: ${{ steps.determine.outputs.will_update == 1 }} | |
name: build ubuntu image | |
env: | |
DOCKER_USERNAME: ${{ secrets.docker_username }} | |
DOCKER_PASSWORD: ${{ secrets.docker_password }} | |
run: ./scripts/build-push-docker.sh ${{ matrix.qgis_type }} ${{ matrix.version }} ${{steps.determine.outputs.qgis_version}} ${{ matrix.ubuntu_dist }} ${DEFAULT_UBUNTU_DIST} | |