Docker Hub Images
calvinbui opened this issue · comments
Hi zorchenhimer,
Could you set up automated Docker builds and images to be pushed to Docker Hub?
I don't really know docker all that well, but this is something that I would like to setup. Learning docker is on my todo list.
I would suggest using GitHub Actions, as, well, you are already using GitHub. You would have to create a DockerHub Account and then push the images to there. I don't have much experience with GitHub Actions, but I played around a bit and something like this should suffice to push out an latest image:
name: Docker Image CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: my-docker-hub-namespace/my-docker-hub-repository
tags: latest
Just create a personal access token on Docker Hub and then save your username and the token as a secrets in this Git Repository (under Settings -> Secrets).
Then match the repository name in the 2nd last line of above to the one you have on Docker Hub.
This would currently push on every change on master. I think from reading here https://github.com/features/actions that with a free plan you have about 2000 free minutes per month, if that doesn't suffice I would suggest removing the automated build on push to master and just start it manually whenever you think it's worth it.