Created
October 14, 2019 10:43
-
-
Save Mattamorphic/148e5f407722a8e382ea21ae114dee31 to your computer and use it in GitHub Desktop.
Docker with GitHub Actions
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'docker-example/*' | |
| - '.github/workflows/docker-example.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Build and tag image | |
| run: docker build -t "docker.pkg.github.com/$GITHUB_REPOSITORY/docker-example:$GITHUB_SHA" -f docker-example/Dockerfile . | |
| - name: Docker login | |
| run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p $GITHUB_TOKEN | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| - name: Publish to GPR | |
| run: docker push "docker.pkg.github.com/$GITHUB_REPOSITORY/docker-example:$GITHUB_SHA" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given a repository with the structure