From d22055dd9a44a2c2259a2a995b274c9220acdff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Andr=C3=A9=20Damas?= Date: Mon, 2 Jun 2025 11:11:05 +0000 Subject: [PATCH] initial import --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 12 ++++++++++++ start.sh | 10 ++++++++++ 3 files changed, 64 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cbd7c6d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +FROM debian:bookworm-slim + +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV OPENTTD_JGR_VERSION=0.65.3 + +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + git \ + libsdl2-dev \ + libsdl2-mixer-dev \ + libfontconfig-dev \ + libicu-dev \ + libpng-dev \ + liblzma-dev \ + liblzo2-dev \ + libzstd-dev \ + pkg-config \ + wget \ + unzip \ + && apt-get clean + +WORKDIR /openttd + +RUN git clone --depth 1 --branch jgrpp-$OPENTTD_JGR_VERSION https://github.com/JGRennison/OpenTTD-patches.git source + +# Build the source +WORKDIR /openttd/source +RUN mkdir build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release && \ + make -j$(nproc) + +WORKDIR /openttd +RUN mkdir -p /root/.openttd/baseset && \ + wget -q https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip && \ + unzip opengfx-7.1-all.zip -d /root/.openttd/baseset && \ + rm opengfx-7.1-all.zip + +COPY start.sh /start.sh +RUN chmod +x /start.sh +CMD ["/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..47877a2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + openttd-jgr: + image: forgejo.venusian.stream/skkeeper/openttd-jgr:latest + container_name: openttd-jgr + volumes: + - ./save:/root/.openttd/save + # - ./content:/root/.openttd/content + # - ./config:/root/.openttd + ports: + - "3979:3979/udp" + - "3979:3979/tcp" + restart: unless-stopped diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..ede2521 --- /dev/null +++ b/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SAVE_FILE="/root/.openttd/save/autosave/latest.sav" + +if [ -f "$SAVE_FILE" ]; then + echo "Loading savegame: $SAVE_FILE" + exec /openttd/source/build/openttd -D -g autosave/latest.sav +else + echo "No savegame found. Starting new game." + exec /openttd/source/build/openttd -D +fi