Files
haylanandClaude-Bot 4a4e5d5f6d fix(docker): bake blender_path into EditorSettings for headless import
Godot's headless --import/--export-release refuses to auto-detect Blender
for .blend import: "Blender path is invalid or not set... Cannot configure
blender path in headless mode" (modules/gltf/editor/editor_scene_importer_blend.cpp).
Without this, the image's Blender install was silently unusable for its one
job — no .blend file would ever import in CI.

Bakes filesystem/import/blender/blender_path into a per-minor-version
EditorSettings .tres, same pattern barichello/godot-ci and abarichello's own
Dockerfile use for Android SDK/JDK paths.

Found and verified while resolving ticket #9 (Merge, publish, and validate
the debian-slim image end-to-end): confirmed a .blend import produces a real
.scn with this fix, and fails without it, on a real container built from
this Dockerfile.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-07 00:37:48 +02:00

63 lines
4.1 KiB
Docker

# GODOT_VERSION is a stable Godot release tag (e.g. "4.7.1", no "-stable" suffix — Godot 4.0+
# only, see docs/handoff/godot-ci-custom-image.md). BLENDER_URL is the tarball to bake in.
# .gitea/workflows/publish.yml always resolves both at build time via
# scripts/resolve-godot-version.sh and scripts/resolve-blender-url.sh. The defaults below are
# only a fallback for a plain local `docker build`.
#
# Godot itself is downloaded straight from its official GitHub releases (godot-builds), the same
# source barichello/godot-ci's own Dockerfile uses — this image no longer depends on that image
# as a base. Decided via wayfinder map https://git.arthurerlich.de/haylan/godot-ci/issues/2,
# ticket https://git.arthurerlich.de/haylan/godot-ci/issues/7: Alpine was considered and rejected
# (official Godot/Blender binaries are glibc-only, and Alpine's musl-native alternatives live
# only on its unpinned `edge` repo); a plain glibc-slim base doesn't cost the compatibility risk.
ARG GODOT_VERSION=4.7.1
FROM debian:bookworm-slim
ARG GODOT_VERSION
ARG BLENDER_URL=https://download.blender.org/release/Blender4.2/blender-4.2.3-linux-x64.tar.xz
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl unzip xz-utils \
libfontconfig1 \
build-essential scons pkg-config \
libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev \
libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev libwayland-dev \
mingw-w64 \
# Blender's own runtime deps, not pulled in by anything above — without
# these `blender --version` fails with "libxkbcommon.so.0: cannot open
# shared object file" (caught via a local `docker build`, see README).
libxkbcommon0 libsm6 libice6 \
&& update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \
&& update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix \
&& rm -rf /var/lib/apt/lists/* \
# Godot editor + export templates, straight from the official release (same URL shape
# barichello/godot-ci's own Dockerfile uses) — stable releases only, matching what
# scripts/resolve-godot-version.sh resolves.
&& curl -fsSLO "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip" \
&& curl -fsSLO "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz" \
&& mkdir -p "/root/.local/share/godot/export_templates/${GODOT_VERSION}.stable" \
&& unzip -q "Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip" \
&& mv "Godot_v${GODOT_VERSION}-stable_linux.x86_64" /usr/local/bin/godot \
&& unzip -q "Godot_v${GODOT_VERSION}-stable_export_templates.tpz" \
&& mv templates/* "/root/.local/share/godot/export_templates/${GODOT_VERSION}.stable/" \
&& rm -rf "Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip" "Godot_v${GODOT_VERSION}-stable_export_templates.tpz" templates \
# Blender is not bundled anywhere here — install the resolved tarball straight from
# download.blender.org instead of an apt package.
&& curl -fsSL "$BLENDER_URL" -o /tmp/blender.tar.xz \
&& mkdir -p /opt/blender \
&& tar -xJf /tmp/blender.tar.xz -C /opt/blender --strip-components=1 \
&& ln -sf /opt/blender/blender /usr/local/bin/blender \
&& rm /tmp/blender.tar.xz \
# Godot's headless `--import`/`--export-release` refuses to auto-detect Blender for .blend
# import ("Blender path is invalid or not set... Cannot configure blender path in headless
# mode") — it has to be pre-baked into EditorSettings, same as barichello/godot-ci bakes
# Android SDK/JDK paths into its editor_settings.tres. Settings are stored per minor version
# since Godot 4.3 (see abarichello/godot-ci's own Dockerfile for this same pattern).
&& mkdir -p /root/.config/godot \
&& printf '%s\n' \
'[gd_resource type="EditorSettings" format=3]' \
'' \
'[resource]' \
'filesystem/import/blender/blender_path = "/usr/local/bin/blender"' \
> "/root/.config/godot/editor_settings-${GODOT_VERSION%.*}.tres"