Build Containers #1590
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: Build Containers | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '30 3 * * 0' | |
concurrency: | |
group: build | |
cancel-in-progress: true | |
jobs: | |
build-push: | |
runs-on: ubuntu-22.04 | |
name: Build and push containers | |
strategy: | |
matrix: | |
include: | |
- | |
baseimage: "debian:bookworm" | |
tags: ["latest", "bookworm"] | |
- | |
baseimage: "debian:bullseye" | |
tags: ["bullseye"] | |
- | |
baseimage: "python:3.13-bookworm" | |
tags: ["python", "python-bookworm", "python3.13", "python3.13-bookworm"] | |
- | |
baseimage: "python:3.12-bookworm" | |
tags: ["python3.12", "python3.12-bookworm"] | |
- | |
baseimage: "python:3.11-bookworm" | |
tags: ["python3.11", "python3.11-bookworm"] | |
- | |
baseimage: "python:3.10-bookworm" | |
tags: ["python3.10", "python3.10-bookworm"] | |
- | |
baseimage: "python:3.9-bookworm" | |
tags: ["python3.9", "python3.9-bookworm"] | |
- | |
baseimage: "python:3.8-bookworm" | |
tags: ["python3.8", "python3.8-bookworm"] | |
- | |
baseimage: "python:3.13-bullseye" | |
tags: ["python-bullseye", "python3.13-bullseye"] | |
- | |
baseimage: "python:3.12-bullseye" | |
tags: ["python3.12-bullseye"] | |
- | |
baseimage: "python:3.11-bullseye" | |
tags: ["python3.11-bullseye"] | |
- | |
baseimage: "python:3.10-bullseye" | |
tags: [ "python3.10-bullseye"] | |
- | |
baseimage: "python:3.9-bullseye" | |
tags: ["python3.9-bullseye"] | |
- | |
baseimage: "python:3.8-bullseye" | |
tags: ["python3.8-bullseye"] | |
steps: | |
- | |
name: Set variables | |
id: vars | |
run: | | |
echo "gh-repo=ghcr.io/${GITHUB_REPOSITORY_OWNER}/raspberrypi-os" >> $GITHUB_OUTPUT | |
echo "dh-repo=${GITHUB_REPOSITORY_OWNER}/raspberrypi-os" >> $GITHUB_OUTPUT | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
pull: true | |
platforms: linux/arm64,linux/arm/v7 | |
tags: | | |
${{ steps.vars.outputs.gh-repo }}:${{ join(matrix.tags, format(',{0}:', steps.vars.outputs.gh-repo)) }}, | |
${{ steps.vars.outputs.dh-repo }}:${{ join(matrix.tags, format(',{0}:', steps.vars.outputs.dh-repo)) }} | |
build-args: BASE_CONTAINER=${{ matrix.baseimage }} | |
cache-from: type=registry,ref=${{ steps.vars.outputs.gh-repo }}-cache:${{ matrix.tags[0] }} | |
cache-to: type=registry,ref=${{ steps.vars.outputs.gh-repo }}-cache:${{ matrix.tags[0] }},mode=max | |
# lite-build-push: | |
# runs-on: ubuntu-22.04 | |
# name: Build and push lite containers | |
# needs: [build-push] | |
# strategy: | |
# matrix: | |
# include: | |
# - | |
# rpi-baseimage: "ghcr.io/${{ github.repository_owner }}/raspberrypi-os:bookworm" | |
# tags: ["lite", "lite-bookworm"] | |
# - | |
# rpi-baseimage: "ghcr.io/${{ github.repository_owner }}/raspberrypi-os:bullseye" | |
# tags: ["lite-bullseye"] | |
# steps: | |
# - | |
# name: Set variables | |
# id: vars | |
# run: | | |
# echo "gh-repo=ghcr.io/${GITHUB_REPOSITORY_OWNER}/raspberrypi-os" >> $GITHUB_OUTPUT | |
# echo "dh-repo=${GITHUB_REPOSITORY_OWNER}/raspberrypi-os" >> $GITHUB_OUTPUT | |
# - | |
# name: Checkout | |
# uses: actions/checkout@v4 | |
# - | |
# name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# - | |
# name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# - | |
# name: Login to Github Container Registry | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - | |
# name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# - | |
# name: Build and push | |
# uses: docker/build-push-action@v5 | |
# with: | |
# push: true | |
# pull: true | |
# platforms: linux/arm64,linux/arm/v7 | |
# file: Dockerfile.lite | |
# tags: | | |
# ${{ steps.vars.outputs.gh-repo }}:${{ join(matrix.tags, format(',{0}:', steps.vars.outputs.gh-repo)) }}, | |
# ${{ steps.vars.outputs.dh-repo }}:${{ join(matrix.tags, format(',{0}:', steps.vars.outputs.dh-repo)) }} | |
# build-args: RPI_BASE_CONTAINER=${{ matrix.rpi-baseimage }} | |
# cache-from: type=registry,ref=${{ steps.vars.outputs.gh-repo }}-cache:${{ matrix.tags[0] }} | |
# cache-to: type=registry,ref=${{ steps.vars.outputs.gh-repo }}-cache:${{ matrix.tags[0] }},mode=max | |
dockerhub-desc: | |
runs-on: ubuntu-22.04 | |
name: Docker Hub description | |
#needs: [build-push, lite-build-push] | |
needs: [build-push] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: ${{ github.repository_owner }}/raspberrypi-os | |
short-description: Raspberry Pi OS Base Images |