forked from ropenttd/docker_openttd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
97 lines (77 loc) · 2.38 KB
/
Dockerfile
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# BUILD ENVIRONMENT
FROM debian:stable-slim AS ottd_build
ARG OPENTTD_VERSION="1.11.2"
ARG OPENGFX_VERSION="0.6.0"
# Setup user and group parameters
ENV PUID="1035"
ENV GUID="100"
# Get things ready
RUN mkdir -p /config \
&& mkdir /tmp/src
# Install build dependencies
RUN apt-get update && \
apt-get install -y \
unzip \
wget \
git \
g++ \
make \
cmake \
patch \
zlib1g-dev \
liblzma-dev \
liblzo2-dev \
pkg-config
# Build OpenTTD itself
WORKDIR /tmp/src
RUN git clone https://github.com/OpenTTD/OpenTTD.git . \
&& git fetch --tags \
&& git checkout ${OPENTTD_VERSION}
# Perform the build with the build script (1.11 switches to cmake, so use a script for decision making)
ADD builder.sh /usr/local/bin/builder
RUN chmod +x /usr/local/bin/builder && builder && rm /usr/local/bin/builder
# Add the latest graphics files
## Install OpenGFX
RUN mkdir -p /app/data/baseset/ \
&& cd /app/data/baseset/ \
&& wget -q https://cdn.openttd.org/opengfx-releases/0.6.1/opengfx-0.6.1-all.zip \
&& unzip opengfx-0.6.1-all.zip \
&& tar -xf opengfx-0.6.1.tar \
&& rm -rf opengfx-*.tar opengfx-*.zip
# END BUILD ENVIRONMENT
# DEPLOY ENVIRONMENT
FROM debian:stable-slim
ARG OPENTTD_VERSION="1.11.2"
LABEL org.label-schema.name="OpenTTD" \
org.label-schema.description="Lightweight build of OpenTTD, designed for server use, with some extra helping treats." \
org.label-schema.url="https://github.com/ropenttd/docker_openttd" \
org.label-schema.vcs-url="https://github.com/openttd/openttd" \
org.label-schema.vendor="Reddit OpenTTD" \
org.label-schema.version=$OPENTTD_VERSION \
org.label-schema.schema-version="1.0"
MAINTAINER duck. <[email protected]>
# Setup the environment and install runtime dependencies
RUN mkdir -p /config \
&& useradd -d /config -u 911 -s /bin/false openttd \
&& apt-get update \
&& apt-get install -y \
libc6 \
zlib1g \
liblzma5 \
liblzo2-2
WORKDIR /config
# Copy the game data from the build container
COPY --from=ottd_build /app /app
# Add the entrypoint
ADD entrypoint.sh /usr/local/bin/entrypoint
# Expose the volume
RUN chown -R openttd:openttd /config /app
VOLUME /config
# Expose the gameplay port
EXPOSE 3979/tcp
EXPOSE 3979/udp
# Expose the admin port
EXPOSE 3977/tcp
# Finally, let's run OpenTTD!
USER ${PUID}:${GUID}
CMD /usr/local/bin/entrypoint