From 7fdd1c39a7c7150d6b1c11605c2dfb2fec682aac Mon Sep 17 00:00:00 2001 From: autocommit Date: Tue, 26 May 2026 13:02:45 -0700 Subject: [PATCH] =?UTF-8?q?hotfix(docker-specific):=20=F0=9F=9A=91?= =?UTF-8?q?=EF=B8=8F=20Update=20Docker=20entrypoint=20to=20install=20SHA-m?= =?UTF-8?q?atched=20.so=20file=20deterministically=20during=20container=20?= =?UTF-8?q?startup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- tools/docker/mc-ai-entrypoint.sh | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tools/docker/mc-ai-entrypoint.sh diff --git a/tools/docker/mc-ai-entrypoint.sh b/tools/docker/mc-ai-entrypoint.sh new file mode 100755 index 00000000..5cb4f327 --- /dev/null +++ b/tools/docker/mc-ai-entrypoint.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# mc-ai-entrypoint.sh — installs the image-baked GDExtension .so into the +# bind-mounted worktree's addons directory, then execs whatever command the +# caller passed. +# +# Why: scripts/mc-ai-docker.sh bind-mounts the per-run scratch worktree at +# /work so Godot sees the project tree, JSON game pack, and tools/ scripts. +# The .so artifact in /opt/mc-ai/ was built from the same SHA when the image +# was built; installing it into the worktree at container start guarantees +# Godot loads the SHA-matched artifact and we never accidentally pick up a +# stale .so the worktree might carry. + +set -euo pipefail + +ADDON_DIR="/work/src/game/engine/addons/magic_civ_physics" +BAKED="/opt/mc-ai/libmagic_civ_physics.x86_64.so" + +if [[ ! -f "${BAKED}" ]]; then + echo "ERROR: baked .so missing at ${BAKED} — Dockerfile.mc-ai build is incomplete." >&2 + exit 2 +fi + +if [[ ! -d "${ADDON_DIR}" ]]; then + echo "ERROR: ${ADDON_DIR} missing — bind-mount the project worktree at /work." >&2 + exit 2 +fi + +install -m 0755 "${BAKED}" "${ADDON_DIR}/libmagic_civ_physics.x86_64.so" + +# Purge any stale macOS dylib the worktree may carry — Godot on Linux +# shouldn't try to load it but pruning eliminates the question. +rm -f "${ADDON_DIR}/libmagic_civ_physics.dylib" + +exec "$@"