Skip to content

Container Build

Container Build #274

name: "Container Build"
on:
workflow_dispatch: # needed for manually running this workflow
schedule:
- cron: "15 3 * * *" # sadly there is no TZ support here
push:
branches:
- "main"
- "develop"
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: moby/buildkit:latest
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Build container
run: |
RUN_KIND="${{ github.event_name }}"
case "$RUN_KIND" in
workflow_dispatch|schedule)
# full run (manual trigger or cron) – build and push the image with ref-specific tag
REPO="$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')"
PARAMS="--output type=image,\"name=ghcr.io/${REPO}:${{ github.ref_name }}\",push=true"
;;
*)
# lightweight fallback (e.g. push event) – skip image push and use reduced wiki dataset
PARAMS="--output type=image,push=false --opt build-arg:WIKI_FILE=website/test/3rd-Party-Modules.md"
;;
esac
# registry credentials
export DOCKER_CONFIG="$(pwd)/container"
echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64 -w 0)\"}}}" > $DOCKER_CONFIG/config.json
# build
buildctl-daemonless.sh build \
--progress plain \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=container \
--opt build-arg:GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
$PARAMS