-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from alec-pinson/workflow
Setup workflow for building & publishing docker image
- Loading branch information
Showing
2 changed files
with
73 additions
and
4 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,62 @@ | ||
# Runs on PR or Release and only if Dockerfile exists and not docs being updated | ||
name: docker build & publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
paths-ignore: | ||
- 'docs/**' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Check Dockerfile exists | ||
id: dockerfile | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "Dockerfile" | ||
- | ||
name: Set up QEMU | ||
if: steps.Dockerfile.outputs.files_exists == 'true' | ||
id: qemu | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: arm | ||
- | ||
name: Set up Docker Buildx | ||
if: steps.Dockerfile.outputs.files_exists == 'true' | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Docker meta | ||
if: steps.Dockerfile.outputs.files_exists == 'true' | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: theyosh/terrariumpi | ||
- | ||
name: Login to DockerHub | ||
if: steps.Dockerfile.outputs.files_exists == 'true' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
if: steps.Dockerfile.outputs.files_exists == 'true' | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/arm/v7 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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