-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
85 lines (78 loc) · 3.65 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
FROM ubuntu:16.04 as install
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=linux/amd64
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
# Install network utilities which can be useful for debugging issues
# Install unzip and zip for the sake of applying ESAI strategies in ./mods/*/levels/*/server.zip at './GameModes/[gpm_coop|gpm_cq|sp1|sp2|sp3]/[16|32|64]/AI/Strategies.ai'
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
conntrack dnsutils iproute2 netcat net-tools tcpdump \
unzip zip \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
# Install Battlefield 2 server
WORKDIR /root
COPY aibehaviours-fixlookatwrapper.ai /aibehaviours-fixlookatwrapper.ai
RUN set -eux; \
curl -sSLO https://files.startersclan.com/ea/bf2/bf2-linuxded-1.5.3153.0-installer.tgz; \
sha256sum bf2-linuxded-1.5.3153.0-installer.tgz | grep "^4d849218c1725e7bd6a7e7f164e27b036248f8ded2e30340dd0722c1dfffbab6 "; \
tar -zxvf bf2-linuxded-1.5.3153.0-installer.tgz; \
sh bf2-linuxded-1.5.3153.0-installer.sh --target /install --noexec --info; \
sh bf2-linuxded-1.5.3153.0-installer.sh --target /install --noexec; \
rm -v bf2-linuxded-1.5.3153.0-installer.sh; \
rm -v bf2-linuxded-1.5.3153.0-installer.tgz; \
cd /install; \
mkdir -p /server; \
# Show the licenses without a pager
cat /install/license.sh | sed 's/^more/cat/' > /install/license-fixed.sh; \
# Agree to licenses
printf '\naccept\n\nyes\n/server\ny\n' | sh /install/license-fixed.sh; \
find /server; \
rm -rf /install; \
# Apply the LookAtWrapper fix to prevent crashes when playing with bots
mv -v /server/bf2/mods/bf2/ai/aibehaviours.ai /server/bf2/mods/bf2/ai/aibehaviours.ai.original; \
cp -v /aibehaviours-fixlookatwrapper.ai /server/bf2/mods/bf2/ai/aibehaviours.ai; \
mv -v /server/bf2/mods/xpack/ai/aibehaviours.ai /server/bf2/mods/xpack/ai/aibehaviours.ai.original; \
cp -v /aibehaviours-fixlookatwrapper.ai /server/bf2/mods/xpack/ai/aibehaviours.ai; \
rm -v /aibehaviours-fixlookatwrapper.ai
# Install bf2stats 2.6.0
WORKDIR /root
RUN set -eux; \
curl -sSLO https://github.com/startersclan/bf2stats/archive/refs/tags/2.6.0.tar.gz; \
echo "7a75b58fec1b1d105c1a495e543eff6f2ee0fd0bf4ab010078539ef95e55f6e7 2.6.0.tar.gz" | sha256sum -c -; \
mkdir -p extract; \
tar -C extract -zxvf 2.6.0.tar.gz; \
rm -rf /server/bf2/python; \
mv extract/bf2stats-2.6.0/src/python /server/bf2/python; \
rm -fv 2.6.0.tar.gz; \
rm -rf extract
# Install ESAI in all mods
WORKDIR /root
COPY ESAI-Standard-v4.2.zip ESAI-Standard-v4.2.zip
COPY lowercase-helper /usr/local/bin/lowercase-helper
RUN set -eux; \
sha256sum ESAI-Standard-v4.2.zip | grep '^ef4e5d0f1446b9a2ddb0b350f1334273681c0f64d9c38c506320db769b24499c '; \
# Lowercase all files in ESAI folder
for i in $( ls /server/bf2/mods ); do \
unzip ESAI-Standard-v4.2.zip -d /server/bf2/mods/$i; \
lowercase-helper --dir "/server/bf2/mods/$i/ESAI"; \
done; \
# Lowercase ESAI mapfiles' content
for i in $( find /server/bf2/mods/*/esai/mapfiles -type f ); do \
CONTENT=$( cat "$i" ); \
echo "$CONTENT" | tr '[:upper:]' '[:lower:]' > "$i"; \
done;
# Install esai-helper and configs
COPY esai-helper /usr/local/bin/esai-helper
COPY esai-optimized-strategies-bf2.txt /esai-optimized-strategies-bf2.txt
COPY esai-optimized-strategies-xpack.txt /esai-optimized-strategies-xpack.txt
COPY healthcheck /healthcheck
# EXPOSE 16567/udp
# EXPOSE 29900/udp
# HEALTHCHECK CMD /healthcheck
WORKDIR /server/bf2
CMD [ "./start.sh" ]