-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
87 lines (76 loc) · 2.22 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
# Build stage for compiling Zandronum
FROM ubuntu:20.04 AS build
WORKDIR /build
ENV DEBIAN_FRONTEND=noninteractive
RUN true \
&& apt-get update -qq \
&& apt-get install -qq --no-install-recommends \
ca-certificates \
mercurial \
g++ \
cmake \
ninja-build \
libssl-dev \
libsdl1.2-dev \
wget \
patch \
> /dev/null
# So we can use bash arrays (default /bin/sh doesn't support this)
SHELL ["/bin/bash", "-c"]
ARG REPO_URL
ARG REPO_TAG
# Clone the Repository
RUN true \
&& test -n "$REPO_URL" && test -n "$REPO_TAG" \
&& hg clone "$REPO_URL" -r "$REPO_TAG" zandronum
WORKDIR /build/zandronum
# Apply Manual Patches (make sure they are UTF-8 encoded)
COPY docker-files/patches /patches
RUN true \
&& shopt -s nullglob \
&& for p in /patches/*.patch; do patch -p1 < $p; done
# Build Zandronum
RUN true \
&& cmake -G Ninja -W no-dev \
-D CMAKE_BUILD_TYPE=Release \
-D SERVERONLY=1 \
-D CMAKE_C_FLAGS="-w" \
-D CMAKE_CXX_FLAGS="-w" \
. \
&& cmake --build .
# Install Zandronum
ENV INSTALL_DIR=/usr/local/games/zandronum
COPY docker-files/zandronum-server.sh /usr/local/bin/zandronum-server
RUN true \
&& COPY_PATTERNS=(\
zandronum-server \
zandronum.pk3 \
) \
&& mkdir -p "$INSTALL_DIR" \
&& cp "${COPY_PATTERNS[@]}" "$INSTALL_DIR/" \
&& bin_path=/usr/local/bin/zandronum-server \
&& chmod a+x $bin_path \
&& sed -i "s|INSTALL_DIR|${INSTALL_DIR}|" $bin_path
# Install GeoIP.dat
COPY docker-files/GeoLite2-Country.mmdb "$INSTALL_DIR/GeoIP.dat"
# Final stage for running the zandronum server.
# Copies over everything in /usr/local.
FROM ubuntu:20.04
COPY --from=build /usr/local/ /usr/local/
RUN true \
&& apt-get update -qq \
&& apt-get install -qq --no-install-recommends \
tini \
libssl1.1 \
libsdl1.2debian \
gosu \
> /dev/null \
&& rm -rf /var/lib/apt/lists/*
# Environment variables used to map host UID/GID to internal
# user used to launch zandronum-server.
ENV ZANDRONUM_UID= \
ZANDRONUM_GID=
# Entrypoint
COPY ./docker-files/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["tini", "--", "/entrypoint.sh"]