Docker Image #690
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 Image | |
on: | |
schedule: | |
- cron: "0 14 * * *" # everyday at 2pm | |
push: | |
branches: ["**"] | |
tags: ["v*.*.*"] | |
env: | |
platforms: linux/amd64 | |
jobs: | |
main: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set imageName based on the repository name | |
id: step_one | |
run: | | |
imageName="${GITHUB_REPOSITORY/docker-/}" | |
echo $imageName | |
echo "imageName=$imageName" >> $GITHUB_ENV | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.imageName }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: ${{ env.platforms }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |