Skip to content

nightly docker builds #355

nightly docker builds

nightly docker builds #355

Workflow file for this run

on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/dev
jobs:
builder:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: custom-ubuntu-large
- platform: linux/arm64
runner: custom-arm
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
id: dev
with:
file: dev/Dockerfile
platforms: ${{ matrix.platform }}
target: dev
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:base
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
build-args: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- run: |
mkdir -p digests/dev
digest="${{ steps.dev.outputs.digest }}"
touch "digests/dev/${digest#sha256:}"
- uses: docker/build-push-action@v6
id: prd
with:
file: dev/Dockerfile
platforms: ${{ matrix.platform }}
target: prd
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:nightly
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
build-args: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- run: |
mkdir -p digests/prd
digest="${{ steps.prd.outputs.digest }}"
touch "digests/prd/${digest#sha256:}"
- uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.runner }}
path: ./digests/*
if-no-files-found: error
retention-days: 1
merger:
needs:
- builder
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: dev
tag: base
- target: prd
tag: nightly
steps:
- uses: actions/download-artifact@v4
with:
pattern: digests-*
merge-multiple: true
path: ./digests
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
cd ./digests/${{ matrix.target }}
docker buildx imagetools create --tag ${{ env.REGISTRY_IMAGE }}:${{ matrix.tag }} $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ matrix.tag }}
cleaner:
needs:
- merger
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: snok/container-retention-policy@v2
with:
account-type: org
org-name: metatypedev
image-names: dev,nightly
cut-off: 12 hours ago UTC
untagged-only: true
token: ${{ secrets.PACKAGE_DELETER_TOKEN }}