-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
84 lines (67 loc) · 1.91 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
# BUILD ENVIRONMENT
FROM debian:stable-slim AS ottd_build
ARG OPENTTD_VERSION="1.10.1"
ARG OPENGFX_VERSION="7.1"
# 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/${OPENGFX_VERSION}/opengfx-${OPENGFX_VERSION}-all.zip \
&& unzip opengfx-${OPENGFX_VERSION}-all.zip \
&& tar -xf opengfx-${OPENGFX_VERSION}.tar \
&& rm -rf opengfx-*.tar opengfx-*.zip
# END BUILD ENVIRONMENT
# DEPLOY ENVIRONMENT
FROM debian:stable-slim
ARG OPENTTD_VERSION="1.10.1"
MAINTAINER duck. <me@duck.me.uk>
# 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 openttd
CMD /usr/local/bin/entrypoint