Publish Docker image on GitHub container registry (ghcr.io) #3
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: "Publish Docker image" | |
# Name of this action (else will name after the commits) | |
run-name: Publish Docker image on GitHub container registry (ghcr.io) | |
# Source: https://dev.to/github/publishing-a-docker-image-to-githubs-container-repository-4n50 | |
on: | |
# TODO: Uncomment these lines | |
# (Currently, they are ensuring that action can only be triggered manually) | |
# push: | |
# branches: main | |
workflow_dispatch: | |
jobs: | |
Publish-docker-image: | |
name: Publish docker image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build the Docker image | |
run: | | |
docker build . --file reproduction/docker/Dockerfile --tag ghcr.io/pythonhealthdatascience/huang2019:latest | |
docker push ghcr.io/pythonhealthdatascience/huang2019:latest |