Build and Push Docker Images #22
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 Docker Images | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
lucky2077/atomicals | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images | |
# You may pin to the exact commit or the version. | |
# uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 | |
uses: docker/build-push-action@v5 | |
with: | |
# List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir) | |
cache-from: type=gha # optional | |
# List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir) | |
cache-to: type=gha,mode=max # optional | |
# Build's context is the set of files located in the specified PATH or URL | |
context: . # optional | |
# List of target platforms for build | |
platforms: linux/amd64,linux/arm64 # optional | |
# Push is a shorthand for --output=type=registry | |
push: true # optional, default is false | |
# List of tags | |
tags: ${{ steps.meta.outputs.tags }} |