Build and publish to Docker Hub #20
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: Build and publish to Docker Hub | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * Sun' ## Update here if needed | |
jobs: | |
docker_hub: | |
name: Push image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract metadata (tags, labels) for the Docker image | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKER_USERNAME }}/${{ vars.DOCKER_REPOSITORY }} | |
- name: Build and push the Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ vars.DOCKER_CONTEXT }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} |