-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
91 lines (78 loc) · 4.01 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
# build zthread
FROM alpine:3.18 as build-zthread
WORKDIR /build
ADD zthread.patch /build
RUN true \
&& set -eux \
&& apk upgrade \
&& apk add alpine-sdk wget \
&& wget -q http://prdownloads.sourceforge.net/zthread/ZThread-2.3.2.tar.gz \
&& tar xfvz ZThread-2.3.2.tar.gz \
&& cd ZThread-2.3.2 \
&& for f in config.guess config.sub; do \
curl -fsSL -o "$f" "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
done \
&& patch -p1 < /build/zthread.patch \
&& mkdir /build/usr \
&& CXXFLAGS="-fpermissive" ./configure --prefix=/build/usr \
&& make -j$((`nproc`+1)) && make install \
&& true
# build armagetronad
FROM alpine:3.18 as build-armagetronad
WORKDIR /build
COPY --from=build-zthread --chmod=0755 "/build/usr/bin/zthread-config" "/usr/lib/bin/"
COPY --from=build-zthread --chmod=0755 "/build/usr/include/zthread" "/usr/include/"
COPY --from=build-zthread --chmod=0755 "/build/usr/lib/libZThread-2.3.so.2" "/usr/lib/"
ARG VERSION
ENV VERSION=$VERSION
RUN true \
&& set -eux \
&& apk upgrade \
&& apk add alpine-sdk autoconf automake bash bison boost-dev libxml2-dev pkgconf protobuf-c-compiler \
&& URLBASE="https://bazaar.launchpad.net/~armagetronad-ap/armagetronad/0.2.9-armagetronad-sty+ct+ap/tarball" \
&& if [ -z ${VERSION} ]; then URL="${URLBASE}"; else REV=$(echo ${VERSION} | cut -d'-' -f3 | sed -r 's/rev//'); URL="${URLBASE}/${REV}"; fi \
&& wget -q -O "armagetronad.tar.gz" $URL \
&& tar xfvz armagetronad.tar.gz --strip=2 \
&& cd 0.2.9-armagetronad-sty+ct+ap \
&& ./bootstrap.sh \
&& mkdir /build/armagetronad \
&& CXXFLAGS="-pipe" ./configure --disable-glout --enable-dedicated --enable-master --enable-authentication --enable-armathentication --enable-krawall --enable-music --disable-automakedefaults --disable-sysinstall --disable-useradd --disable-etc --disable-desktop --disable-initscripts --disable-uninstall --disable-games --with-zthread --prefix=/build/armagetronad --exec_prefix=/build/armagetronad \
&& make -j$((`nproc`+1)) && make install \
&& rm -Rf /build/armagetronad/share/armagetronad-dedicated/desktop \
&& rm -Rf /build/armagetronad/share/armagetronad-dedicated/scripts \
&& true
# create image
FROM alpine:3.18 as create-image
ARG BUILD_DATE \
REVISION \
VERSION
LABEL org.opencontainers.image.title="Armagetron Advanced Server" \
org.opencontainers.image.description="Server docker image for the open source game Armagetron Advanced." \
org.opencontainers.image.version=${VERSION} \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${REVISION} \
org.opencontainers.image.authors="Nicolas Graf <[email protected]>" \
org.opencontainers.image.vendor="Evo eSports e.V." \
org.opencontainers.image.licenses="Apache-2.0"
WORKDIR /armagetronad
RUN true \
&& set -eux \
&& addgroup -g 9999 armagetronad \
&& adduser -u 9999 -Hh /armagetronad -G armagetronad -s /sbin/nologin -D armagetronad \
&& install -d -o armagetronad -g armagetronad -m 775 /armagetronad \
&& apk add --force-overwrite --no-cache libstdc++ libxml2 \
&& mkdir ./data ./userdata ./config ./userconfig ./resource ./autoresource ./var \
&& chown armagetronad:armagetronad -Rf /armagetronad \
&& true
COPY --from=build-zthread --chmod=0755 "/build/usr/lib/libZThread-2.3.so.2" "/usr/lib/"
COPY --from=build-armagetronad --chmod=0755 "/build/armagetronad/bin" "/usr/local/bin"
COPY --from=build-armagetronad --chown=armagetronad:armagetronad --chmod=0755 "/build/armagetronad/etc/armagetronad-dedicated" "./config"
COPY --from=build-armagetronad --chown=armagetronad:armagetronad --chmod=0755 "/build/armagetronad/share/armagetronad-dedicated" "./data"
COPY --chmod=0755 "entrypoint.sh" "/usr/local/bin/"
USER armagetronad
STOPSIGNAL SIGKILL
EXPOSE 4534/udp
HEALTHCHECK --interval=5s --timeout=5s --start-period=10s --retries=3 \
CMD nc -z -v -u 127.0.0.1 4534 || exit 1
VOLUME [ "/armagetronad" ]
ENTRYPOINT [ "entrypoint.sh" ]