geopython / GeoHealthCheck

Service Status and QoS Checker for OGC Web Services
https://geohealthcheck.org
MIT License
83 stars 71 forks source link

Enhance Docker CI to auto-push on release #435

Open justb4 opened 2 years ago

justb4 commented 2 years ago

Is your feature request related to a problem? Please describe. We need a simpler and more modern Docker build/push GH Workflow

Describe the solution you'd like See this article: https://xy2z.io/posts/2022-github-actions-build-push-docker-image/ Plus need to add existing stuff from current docker.yml: no action on doc changes, run unit tests with Docker Image.

So basics:

name: Docker Build and Push

on:
  push:
    branches:
      - 'master'
  release:
    types: [published]

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        # Push to master branch - push "latest" tag
        name: Build and Push (latest)
        if: github.event_name == 'push'
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags: geopython/geohealthcheck:latest
      -
        # Push the new release
        name: Build and Push New Release
        if: github.event_name == 'release'
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags:  geopython/geohealthcheck:${{ github.event.release.tag_name }}

Describe alternatives you've considered NA

Additional context NA