Skip to content

Enhance Docker CI to auto-push on release  #435

@justb4

Description

@justb4

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions