Skip to content

Container on Docker Hub #63

Container on Docker Hub

Container on Docker Hub #63

name: Container on Docker Hub
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '0 10 */16 * *' # twice monthly builds
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
env:
# Use docker.io for Docker Hub if empty, ghcr.io for GitHub
REGISTRY: docker.io
# github.repository as <account>/<repo>
# IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: ${{ secrets.DOCKER_UNAME }}/hdh_dvr
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_UNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract Container image metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64, linux/amd64, linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}