Building and publishing Docker image #6
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 | |
run-name: Building and publishing Docker image | |
on: | |
push: | |
paths: | |
- Dockerfile | |
- src/* | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker BuildX | |
uses: docker/setup-buildx-action@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build an image and push it to the registry | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
tags: | | |
${{ vars.DOCKERHUB_REGISTRY }}:${{ github.sha }} | |
${{ vars.DOCKERHUB_REGISTRY }}:latest |