CI: Add automatic docker build on push and daily (#1)
All checks were successful
Docker / build (ubuntu-22.04, ./images/qt.dockerfile, git.119.224.65.18.sslip.io/siteorg/action-image-qt) (push) Successful in 1m32s
Docker / build (ubuntu-latest, ./images/qt.dockerfile, git.119.224.65.18.sslip.io/siteorg/action-image-qt) (push) Successful in 1m15s

- Automatically builds and publishes docker images on push
- Automatically re-builds images daily to ensure they are up to date with the upstream image

Reviewed-on: #1
Co-authored-by: Lucas Petrino <nsx1lucas@gmail.com>
Co-committed-by: Lucas Petrino <nsx1lucas@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
2024-11-12 22:23:04 +00:00
committed by nsx1luke
parent 7a0fda9889
commit c8c9f5191b

View File

@@ -0,0 +1,79 @@
name: Docker
on:
push:
branches: [ "*" ]
tags: [ 'v*.*.*' ]
schedule:
- cron: "0 0 * * *"
env:
REGISTRY: git.119.224.65.18.sslip.io
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./images/qt.dockerfile
image: git.119.224.65.18.sslip.io/siteorg/action-image-qt
base: ubuntu-22.04
- dockerfile: ./images/qt.dockerfile
image: git.119.224.65.18.sslip.io/siteorg/action-image-qt
base: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3.6.0
with:
cosign-release: 'v2.2.4'
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
driver-opts: network=host
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ matrix.image }}-${{ matrix.base }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max