Files
sor/Client/origin-client/Dockerfile.web
T
c6177cd627 build(web): two-step import+export, diagnose templates, drop --path
- Split into godot --import then godot --export-release to avoid the
  race condition where _fs_changed fires before Web export platform
  is fully registered (causes empty "configuration errors" list)
- Remove --path /project (WORKDIR is already /project; matches
  barichello/godot-ci example usage)
- Add diagnostic RUN that prints the export_templates directory so
  CI logs reveal missing templates immediately
- Expand fallback export_presets.cfg with all required Godot 4.5
  Web preset fields (custom_template, variant/extensions_support)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-28 08:09:14 -05:00

60 lines
2.1 KiB
Docker

FROM barichello/godot-ci:4.5 AS build
WORKDIR /project
COPY . .
# Godot web export depends on fontconfig in this runner image.
RUN apt-get update && apt-get install -y --no-install-recommends fontconfig && rm -rf /var/lib/apt/lists/*
# Web export in Godot 4 requires Compatibility renderer; project defaults may differ.
# Safety-net sed: replace any renderer value with gl_compatibility (project.godot already
# uses gl_compatibility; this guards against accidental revert).
RUN sed -i 's#renderer/rendering_method="[^"]*"#renderer/rendering_method="gl_compatibility"#g' project.godot
# Harden CI: ensure export preset exists.
RUN test -f export_presets.cfg || cat > export_presets.cfg <<'CFG'
[preset.0]
name="HTML5"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/web/index.html"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
CFG
# Diagnostic: confirm web export templates are present.
RUN echo "=== Godot export templates ===" \
&& find /root/.local/share/godot/export_templates -maxdepth 2 -type f 2>/dev/null | sort \
|| echo "WARNING: no export templates found at default path"
# Step 1 — import all project resources so the editor cache is fully populated
# before the export step. Running --import first avoids the race condition where
# _fs_changed triggers the export before all editor plugins have registered.
RUN mkdir -p .godot/editor .godot/imported build/web \
&& godot --headless --import 2>&1 | tail -10 || true
# Step 2 — export. Drop --path so Godot uses WORKDIR (matches barichello examples).
RUN godot --headless --export-release "HTML5" build/web/index.html
FROM nginx:1.27-alpine
COPY --from=build /project/build/web/ /usr/share/nginx/html/
EXPOSE 80