Make docker image smaller
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Fábio André Damas 2025-06-02 23:37:27 +00:00
parent 24c6904423
commit f35d23674e
2 changed files with 16 additions and 5 deletions

View file

@ -1,4 +1,4 @@
FROM alpine:latest
FROM alpine:latest AS builder
ENV OPENTTD_JGR_VERSION=0.65.3
@ -26,18 +26,29 @@ 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)
FROM alpine:latest
WORKDIR /openttd
COPY --from=builder /openttd/source/build /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
RUN apk add --no-cache \
sdl2-dev \
fontconfig-dev \
icu-dev \
lzo-dev
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]

View file

@ -1,10 +1,10 @@
#!/bin/bash
#!/bin/sh
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
exec /openttd/openttd -D -g autosave/latest.sav
else
echo "No savegame found. Starting new game."
exec /openttd/source/build/openttd -D
exec /openttd/openttd -D
fi