Skip to content

Publish Docker images #38

Publish Docker images

Publish Docker images #38

Workflow file for this run

# This workflow uses secrets stored in a specific github environment called `dockerhub-publish`.
# It needs to be created in repository settings->environments
# Add the dockerhub username and password in secrets named:
# DOCKERHUB_USERNAME
# DOCKERHUB_PASSWORD
# Add the dockerhub repo path in a secret named:
# DOCKERHUB_REPO
# This workflow will use them automatically.
# FIXME: Refactor this workflow using matrix and the new docker args
name: Publish Docker images
on: workflow_dispatch
# TODO: put this back once the docker files work correctly
# release:
# types: [released]
jobs:
publish-image:
environment: dockerhub-publish
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKERHUB_REPO }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
flavor: |
latest=false
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
file: './Dockerfile'
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}