-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (42 loc) · 2.56 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (42 loc) · 2.56 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
FROM alpine:3.17.2 AS base
# Godot shared environment Variables
ENV GODOT_VERSION="3.6.2"
ENV GODOT_EXPORT_PRESET="linux"
# Install tools for downloading
RUN apk add --no-cache \
wget
# This is needed to run Godot on Alpine
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk && \
apk add --allow-untrusted --force-overwrite glibc-2.31-r0.apk && \
rm -f glibc-2.31-r0.apk
FROM base AS builder
# Download Godot Headless and export templates, version is set from env variables
RUN wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
&& wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
&& mkdir ~/.cache \
&& mkdir -p ~/.config/godot \
&& mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
&& unzip Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
&& mv Godot_v${GODOT_VERSION}-stable_linux_headless.64 /usr/local/bin/godot-headless \
&& unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
&& mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
&& rm -f Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip
# Move to the build directory and export the .pck
WORKDIR /build
COPY . .
RUN godot-headless --path /build --export-pack ${GODOT_EXPORT_PRESET} server.pck
FROM base AS runner
# Path where the HTTPS certs will be mounted when hosting
ENV CONTAINER_CERT_PATH="/secrets/live/jibby.localhost"
# Download Godot Server to run the exported .pck
RUN wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux_server.64.zip \
&& unzip Godot_v${GODOT_VERSION}-stable_linux_server.64.zip \
&& mv Godot_v${GODOT_VERSION}-stable_linux_server.64 /usr/local/bin/godot-server \
&& rm -f Godot_v${GODOT_VERSION}-stable_linux_server.64.zip
# Create links to the HTTPS certs which will be mounted when hosting
RUN mkdir -p ~/.local/share/godot/app_userdata/Flappy\ Race/certs \
&& ln -s ${CONTAINER_CERT_PATH}/fullchain.pem ~/.local/share/godot/app_userdata/Flappy\ Race/certs/X509_certificate.crt \
&& ln -s ${CONTAINER_CERT_PATH}/privkey.pem ~/.local/share/godot/app_userdata/Flappy\ Race/certs/X509_key.key
# Copy the exported .pck and run it
COPY --from=builder /build/server.pck server.pck
ENTRYPOINT [ "/usr/local/bin/godot-server", "--main-pack", "server.pck" ]