Created
January 15, 2020 12:18
-
-
Save PReimers/293af5029068deae1c744a176fa081a5 to your computer and use it in GitHub Desktop.
Publish docker image using GitHub Actions
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 and deploy Docker image | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag docker.pkg.github.com/OWNER/REPO/IMAGE:latest | |
- name: Publish image | |
run: | | |
# ${{ secrets.DOCKER_PASSWORD }} and ${{ secrets.DOCKER_USERNAME }} are secrets defined in the repository. | |
# ${{ secrets.DOCKER_USERNAME }} is my GitHub Username. | |
# ${{ secrets.DOCKER_PASSWORD }} is an auth token. | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin docker.pkg.github.com | |
docker push docker.pkg.github.com/OWNER/REPO/IMAGE:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment