Build and Push Multi-Arch Docker Image #115
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 Push Multi-Arch Docker Image | |
on: | |
push: | |
tags: | |
- v* | |
schedule: | |
- cron: "0 0 * * *" # nightly build | |
workflow_dispatch: # manual trigger | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: aarch64,x86_64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Determine Docker tag | |
id: docker_tag | |
run: | | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
else | |
echo "TAG=latest" >> $GITHUB_ENV | |
fi | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: nanohan/home:${{ env.TAG }} |