-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow to publish Docker container images to Doc…
…ker Hub for "next" branch and semver tag pushes.
- Loading branch information
1 parent
d5ac854
commit 6dfbe1e
Showing
2 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Publish Docker container image to Docker Hub | ||
|
||
on: | ||
push: | ||
branches: | ||
- next | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v2.0.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract tags and labels | ||
id: meta | ||
uses: docker/metadata-action@v4.0.1 | ||
with: | ||
images: ${{ github.repository }} | ||
|
||
- name: Build container image | ||
uses: docker/build-push-action@v3.0.0 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
tags: local:test | ||
labels: ${{ steps.meta.outputs.labels }} | ||
load: true | ||
|
||
- name: Test container image | ||
run: docker run --rm -v $PWD:/workdir local:test "*.md" | ||
|
||
- name: Push container image | ||
uses: docker/build-push-action@v3.0.0 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
platforms: linux/arm64,linux/amd64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true |
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