Skip to content

Build Base Image

Build Base Image #21

name: Build Base Image
on:
schedule:
# Every Monday at 6:22am Eastern Time
- cron: "22 10 * * 1"
workflow_dispatch:
# Allow us to manually trigger build
concurrency:
# This concurrency group is used to prevent multiple builds from running at the same time.
group: build-base-${{ github.ref_name }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
docker-build-baseimage:
name: Build Base Image
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# See comment here: https://github.com/actions/runner-images/issues/1187#issuecomment-686735760
- name: Disable network offload
run: sudo ethtool -K eth0 tx off rx off
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-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: Generate tags for image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/ekirjasto-circ-baseimage
# Generate tags for the image
# We use the following tags:
# - The date in YYYYww format, which is the year and week number. 202052 is the last week of 2020.
# - The latest tag
tags: |
type=schedule,pattern={{date 'YYYYww'}}
type=raw,value=latest
- name: Build base image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.baseimage
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
target: baseimage
cache-to: type=inline
platforms: linux/amd64, linux/arm64