Repository navigation
Expand file tree
/
Copy pathDockerfile.godot
More file actions
75 lines (70 loc) · 3.09 KB
/
Copy pathDockerfile.godot
File metadata and controls
75 lines (70 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# The starter's image with Godot inside, for plugins that run it headless.
# docker build --target full -t gamend-starter .
# docker build -f Dockerfile.godot -t gamend-starter-godot .
ARG BASE=gamend-starter
FROM ${BASE}
WORKDIR /app
ARG GODOT_RELEASE=4.7.2-stable
ENV GODOT_BIN=/opt/godot/godot
# The demo project the base image already carries.
ENV GODOT_PROJECT_PATH=/app/godot
RUN set -eux; \
# Install download tools (base image may be Debian/Ubuntu or Alpine)
if command -v apt-get >/dev/null 2>&1; then \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl unzip libfontconfig1; \
rm -rf /var/lib/apt/lists/*; \
elif command -v apk >/dev/null 2>&1; then \
# Godot Linux binaries/templates are built against glibc; on Alpine (musl)
# we need compat packages so the loader exists.
apk add --no-cache ca-certificates curl unzip fontconfig gcompat libc6-compat libstdc++; \
else \
echo "Unsupported base image: need apt-get or apk"; \
exit 1; \
fi
RUN set -eux; \
arch="$(uname -m)"; \
case "$arch" in \
x86_64|amd64) godot_arch="linux.x86_64" ;; \
aarch64|arm64) godot_arch="linux.arm64" ;; \
*) echo "Unsupported arch: $arch"; exit 1 ;; \
esac; \
url="https://github.com/godotengine/godot/releases/download/${GODOT_RELEASE}/Godot_v${GODOT_RELEASE}_${godot_arch}.zip"; \
mkdir -p /opt/godot; \
curl -fsSL "$url" -o /tmp/godot.zip; \
unzip -q /tmp/godot.zip -d /opt/godot; \
rm -f /tmp/godot.zip; \
# The zip extracts a versioned binary name; normalize to /opt/godot/godot
found_bin="$(find /opt/godot -maxdepth 1 -type f -name 'Godot_v*_linux.*' | head -n 1)"; \
if [ -z "$found_bin" ]; then \
echo "Godot binary not found after unzip"; \
ls -la /opt/godot; \
exit 1; \
fi; \
mv "$found_bin" /opt/godot/godot; \
chmod +x /opt/godot/godot; \
/opt/godot/godot --version || true
RUN set -eux; \
# Install export templates so headless exports work.
# Godot expects: /root/.local/share/godot/export_templates/<version>/*.linux_*
templates_url="https://github.com/godotengine/godot/releases/download/${GODOT_RELEASE}/Godot_v${GODOT_RELEASE}_export_templates.tpz"; \
templates_zip="/tmp/godot_export_templates.tpz"; \
curl -fsSL "$templates_url" -o "$templates_zip"; \
# Basic sanity check: archive should be a valid zip.
unzip -t "$templates_zip" >/dev/null; \
templates_version_dir="$(printf '%s' "$GODOT_RELEASE" | tr '-' '.')"; \
templates_dest="/root/.local/share/godot/export_templates/${templates_version_dir}"; \
mkdir -p "$templates_dest"; \
rm -rf /tmp/godot_templates; \
mkdir -p /tmp/godot_templates; \
unzip -q "$templates_zip" -d /tmp/godot_templates; \
# The tpz contains a top-level templates/ directory.
if [ ! -d /tmp/godot_templates/templates ]; then \
echo "Godot templates archive did not contain templates/"; \
find /tmp/godot_templates -maxdepth 2 -type d -print; \
exit 1; \
fi; \
cp -a /tmp/godot_templates/templates/. "$templates_dest"/; \
rm -rf /tmp/godot_templates "$templates_zip"; \
# Sanity check a couple expected files for the current arch.
find "$templates_dest" -maxdepth 1 -type f -name 'linux_*' | head -n 20 || true