Daily base image update #354
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: Daily base image update | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
jobs: | |
setup_base: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix_base: ${{ steps.matrix_base.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Set notification matrix | |
id: matrix_base | |
run: | | |
echo "matrix=$(.github/bin/find-docker-files.py base-build)" >> $GITHUB_OUTPUT | |
base_build: | |
needs: | |
- setup_base | |
runs-on: "${{ matrix.runner }}" | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.setup_base.outputs.matrix_base) }}" | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Create buildx cache | |
run: | | |
mkdir -p /tmp/.buildx-cache | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set target tag default | |
id: targettag | |
run: | | |
TARGET_TAG=${{ matrix.target }} | |
echo "value=${TARGET_TAG:-target}" >> $GITHUB_OUTPUT | |
- name: Build and push | |
id: docker-build | |
uses: docker/build-push-action@v2 | |
with: | |
context: "{{defaultContext}}:${{ matrix.base }}" | |
push: true | |
file: "Dockerfile" | |
target: "${{ matrix.target }}" | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:latest | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ steps.targettag.outputs.value }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ matrix.version }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ steps.targettag.outputs.value }}-${{ matrix.version }} | |
cache-from: | | |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:buildcache-${{ steps.targettag.outputs.value }} | |
cache-to: | | |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:buildcache-${{ steps.targettag.outputs.value }},mode=max | |
build-args: | | |
git_version=${{ matrix.version }} | |
secrets: | | |
GIT_AUTH_TOKEN=${{ github.token }} | |
setup_languages: | |
needs: | |
- base_build | |
runs-on: ubuntu-latest | |
outputs: | |
matrix_base: ${{ steps.matrix_base.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Set notification matrix | |
id: matrix_base | |
run: | | |
echo "matrix=$(.github/bin/find-docker-files.py base*)" >> $GITHUB_OUTPUT | |
base_languages: | |
runs-on: ubuntu-latest | |
needs: | |
- setup_languages | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.setup_languages.outputs.matrix_base) }}" | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set target tag default | |
id: targettag | |
run: | | |
TARGET_TAG=${{ matrix.target }} | |
if [ -z "$TARGET_TAG" ]; then | |
export TARGET_TAG=target | |
fi | |
echo "value=${TARGET_TAG}" >> $GITHUB_OUTPUT | |
- name: Build and push | |
id: docker-build | |
uses: docker/build-push-action@v2 | |
with: | |
context: "{{defaultContext}}:${{ matrix.base }}" | |
push: true | |
file: "Dockerfile" | |
target: "${{ matrix.target }}" | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:latest | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ steps.targettag.outputs.value }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ steps.targettag.outputs.value }}-${{ matrix.version }} | |
ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:${{ matrix.version }} | |
cache-from: | | |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:buildcache-${{ steps.targettag.outputs.value }} | |
cache-to: | | |
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.base }}:buildcache-${{ steps.targettag.outputs.value }},mode=max | |
build-args: | | |
git_version=${{ matrix.version }} | |
secrets: | | |
GIT_AUTH_TOKEN=${{ github.token }} |