From 7786f078d6dc257eb545d94942a76d83f54b28b9 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Fri, 31 Jul 2026 19:17:14 +0200 Subject: [PATCH] Add CI builder image and use it in the pipeline builder.Dockerfile bakes the export step's dependencies into git.teletype.hu/internal/love-builder and pre-fetches love.js to /opt/lovejs.zip; the Makefile prefers the cached copy and falls back to downloading from GitHub outside the image. Co-Authored-By: Claude Fable 5 --- README.md | 16 ++++++++++++++++ builder.Dockerfile | 21 +++++++++++++++++++++ example-makefile.make | 14 ++++++++++++-- example-woodpecker.yaml | 3 +-- 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 builder.Dockerfile diff --git a/README.md b/README.md index b36b063..52fbc1d 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,20 @@ The pipeline uploads `$(PROJECT)-$(VERSION).love.zip`, the droparea, then triggers `/update` twice: once with `platform=love` (desktop package) and once with `platform=love-web` (web build). +## Builder image + +`builder.Dockerfile` bakes the pipeline's export-step dependencies +(zip/unzip/curl/make + `luac` for the syntax check) into +`git.teletype.hu/internal/love-builder`, and pre-fetches love.js to +`/opt/lovejs.zip` — the Makefile uses the cached copy when present +and only falls back to downloading from GitHub outside the image: + +```sh +docker build --platform linux/amd64 -f builder.Dockerfile \ + -t git.teletype.hu/internal/love-builder:latest . +docker push git.teletype.hu/internal/love-builder:latest +``` + +Rebuild the image to pick up a newer love.js snapshot. + Detailed documentation lives on the wiki: `/development/love`. diff --git a/builder.Dockerfile b/builder.Dockerfile new file mode 100644 index 0000000..9d4ed62 --- /dev/null +++ b/builder.Dockerfile @@ -0,0 +1,21 @@ +# CI builder image for Love2D projects: packaging tools + luac syntax check, +# with love.js pre-fetched to /opt/lovejs.zip so `make web` does not hit +# GitHub on every pipeline run (the Makefile falls back to curl elsewhere). +# +# Build & push (the CI runner is linux/amd64): +# docker build --platform linux/amd64 -f builder.Dockerfile \ +# -t git.teletype.hu/internal/love-builder:latest . +# docker push git.teletype.hu/internal/love-builder:latest + +FROM alpine:3.22 + +RUN apk add --no-cache make zip unzip curl git lua5.4 \ + && ln -sf /usr/bin/lua5.4 /usr/bin/lua \ + && ln -sf /usr/bin/luac5.4 /usr/bin/luac + +RUN curl -sSL https://github.com/2dengine/love.js/archive/refs/heads/master.zip \ + -o /opt/lovejs.zip + +WORKDIR /workspace + +CMD ["/bin/sh"] diff --git a/example-makefile.make b/example-makefile.make index 896697e..edd174a 100644 --- a/example-makefile.make +++ b/example-makefile.make @@ -14,6 +14,11 @@ OUTPUT_WEB_ZIP = $(PROJECT)-$(VERSION).html.zip VERSION_FILE = .version +# The love-builder CI image pre-fetches love.js here; local builds fall +# back to downloading it from GitHub. +LOVEJS_URL = https://github.com/2dengine/love.js/archive/refs/heads/master.zip +LOVEJS_CACHE = /opt/lovejs.zip + all: build build: @@ -35,8 +40,13 @@ love: web: love @mkdir -p $(WEB_DIR) - @echo "==> Downloading love.js (2dengine)" - curl -sSL https://github.com/2dengine/love.js/archive/refs/heads/master.zip -o $(DIST_DIR)/lovejs.zip + @if [ -f $(LOVEJS_CACHE) ]; then \ + echo "==> Using cached love.js ($(LOVEJS_CACHE))"; \ + cp $(LOVEJS_CACHE) $(DIST_DIR)/lovejs.zip; \ + else \ + echo "==> Downloading love.js (2dengine)"; \ + curl -sSL $(LOVEJS_URL) -o $(DIST_DIR)/lovejs.zip; \ + fi unzip -o $(DIST_DIR)/lovejs.zip -d $(DIST_DIR)/lovejs-src rm -f $(DIST_DIR)/lovejs.zip @echo "==> Assembling web bundle" diff --git a/example-woodpecker.yaml b/example-woodpecker.yaml index 3a8ad79..cb4033c 100644 --- a/example-woodpecker.yaml +++ b/example-woodpecker.yaml @@ -6,9 +6,8 @@ steps: - make ci-version - name: export - image: alpine + image: git.teletype.hu/internal/love-builder:latest commands: - - apk add --no-cache zip make curl unzip - make ci-export - name: upload