Merge pull request #138 from shtlrs/json-notifier #120
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: Docker Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
name: Build and push | |
runs-on: ubuntu-latest | |
steps: | |
# Create a commit SHA-based tag for the container repositories | |
- name: Create Container Tags | |
id: tags_generator | |
run: | | |
tag=$(cut -c 1-7 <<< $GITHUB_SHA) | |
echo "::set-output name=tag::$tag" | |
# Check out the current repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
# Set up Docker Buildx and log into DockerHub | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build and push the container to the GitHub Container | |
# Repository. The container will be tagged as "latest" | |
# and with the short SHA of the commit. | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
cache-from: type=registry,ref=lemonsaurus/blackbox:main | |
cache-to: type=inline | |
tags: | | |
lemonsaurus/blackbox:main | |
lemonsaurus/blackbox:${{ steps.tags_generator.outputs.tag }} |