# tinqs/ci godot — headless Godot for game builds and export
# Used by: ariki-game build pipeline (future)
# runs-on: godot
# Headless Godot 4.6 + export templates for Windows/Linux/Web.

ARG BASE_IMAGE=tinqs-runner-base:latest
FROM ${BASE_IMAGE}

ARG GODOT_VERSION=4.6.2

# Headless Godot editor (for --headless --export-all)
RUN curl -fsSL "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip" \
    -o /tmp/godot.zip && \
    unzip -q /tmp/godot.zip -d /tmp && \
    mv /tmp/Godot_v${GODOT_VERSION}-stable_linux.x86_64 /usr/local/bin/godot && \
    chmod +x /usr/local/bin/godot && \
    rm -f /tmp/godot.zip

# Export templates
RUN mkdir -p /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable && \
    curl -fsSL "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz" \
    -o /tmp/templates.tpz && \
    unzip -q /tmp/templates.tpz -d /tmp/templates && \
    mv /tmp/templates/templates/* /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable/ && \
    rm -rf /tmp/templates.tpz /tmp/templates

RUN godot --headless --version
