forked from MitchTalmadge/AMP-dockerized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
198 lines (172 loc) · 5.54 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
FROM ubuntu:20.04
# Set to false to skip downloading the AMP cache which is used for faster upgrades.
ARG CACHE_AMP_UPGRADE=true
ARG TARGETPLATFORM
ENV UID=1000
ENV GID=1000
ENV TZ=Etc/UTC
ENV PORT=8080
ENV USERNAME=admin
ENV PASSWORD=password
ENV LICENCE=notset
ENV MODULE=ADS
ENV IPBINDING=0.0.0.0
ENV AMP_SUPPORT_LEVEL=UNSUPPORTED
ENV AMP_SUPPORT_TOKEN=AST0/MTAD
ENV AMP_SUPPORT_TAGS="nosupport docker community unofficial unraid"
ENV AMP_SUPPORT_URL="https://github.com/MitchTalmadge/AMP-dockerized/"
ARG DEBIAN_FRONTEND=noninteractive
# Initialize
RUN apt-get update && \
apt-get install -y --no-install-recommends \
jq \
sed \
tzdata \
wget && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# Configure Locales
RUN apt-get update && \
apt-get install -y --no-install-recommends locales && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Add Mono apt source
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https \
dirmngr \
software-properties-common \
gnupg \
ca-certificates && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list
# Install Mono Certificates
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates-mono && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
RUN wget -O /tmp/cacert.pem https://curl.haxx.se/ca/cacert.pem && \
cert-sync /tmp/cacert.pem
# Declare and install AMP dependencies
ARG AMPDEPS="\
# Dependencies for AMP:
tmux \
git \
socat \
unzip \
iputils-ping \
procps"
ARG MCDEPS="\
# Dependencies for Minecraft:
openjdk-17-jre-headless \
openjdk-11-jre-headless \
openjdk-8-jre-headless"
ARG SRCDSDEPS="\
# Dependencies for srcds (TF2, GMod, ...)
lib32gcc1 \
lib32stdc++6 \
lib32z1 \
libbz2-1.0:i386 \
libcurl3-gnutls:i386 \
libcurl4 \
libncurses5:i386 \
libsdl2-2.0-0 \
libsdl2-2.0-0:i386 \
libtinfo5:i386"
ARG FACDEPS="\
# Dependencies for Factorio:
xz-utils"
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
dpkg --add-architecture aarch64 && \
apt-get update && \
apt-get install -y \
$AMPDEPS \
$MCDEPS \
$FACDEPS; \
else \
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
$AMPDEPS \
$MCDEPS \
$SRCDSDEPS \
$FACDEPS; \
fi && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# Set Java default
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
update-alternatives --set java /usr/lib/jvm/java-17-openjdk-arm64/bin/java; \
else update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java; \
fi
# Manually install ampinstmgr by extracting it from the deb package.
# Docker doesn't have systemctl and other things that AMP's deb postinst expects,
# so we can't use apt to install ampinstmgr.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
apt-transport-https
# Add CubeCoders repository and key
RUN apt-key adv --fetch-keys http://repo.cubecoders.com/archive.key && \
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
apt-add-repository "deb http://repo.cubecoders.com/aarch64 debian/"; \
else apt-add-repository "deb http://repo.cubecoders.com/ debian/"; \
fi && \
apt-get update && \
# Just download (don't actually install) ampinstmgr
apt-get install -y --no-install-recommends --download-only ampinstmgr && \
# Extract ampinstmgr from downloaded package
mkdir -p /tmp/ampinstmgr && \
dpkg-deb -x /var/cache/apt/archives/ampinstmgr_*.deb /tmp/ampinstmgr && \
mv /tmp/ampinstmgr/opt/cubecoders/amp/ampinstmgr /usr/local/bin/ampinstmgr && \
apt-get -y clean && \
apt-get -y autoremove --purge && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# Get the latest AMP Core to pre-cache upgrades.
RUN if [ "$CACHE_AMP_UPGRADE" = "true" ]; then \
echo "Pre-caching AMP Upgrade..." && \
wget https://cubecoders.com/AMPVersions.json -O /tmp/AMPVersions.json && \
if [ "$TARGETPLATFORM" = "linux/arm64 "]; then \
wget https://cubecoders.com/Downloads/Release/AMP_Latest_AArch64.zip -O /opt/AMPCache-$(cat /tmp/AMPVersions.json | jq -r '.AMPCore' | sed -e 's/\.//g').zip; \
else wget https://cubecoders.com/Downloads/AMP_Latest.zip -O /opt/AMPCache-$(cat /tmp/AMPVersions.json | jq -r '.AMPCore' | sed -e 's/\.//g').zip; \
fi; \
else echo "Skipping AMP Upgrade Pre-cache."; \
fi
# Set up environment
COPY entrypoint /opt/entrypoint
RUN chmod -R +x /opt/entrypoint
VOLUME ["/home/amp/.ampdata"]
ENTRYPOINT ["/opt/entrypoint/main.sh"]