Fixed dockerfile and changed start.sh
This commit is contained in:
parent
5475afc09d
commit
c94c8b1509
@ -6,33 +6,17 @@ MAINTAINER Thijn <thijn@viceunderdogs.com>
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
unzip \
|
||||
p7zip
|
||||
p7zip \
|
||||
&& adduser --disabled-password --home /home/container container
|
||||
|
||||
# Download and extract server files
|
||||
# Choose a more general directory name which does not contain any version
|
||||
RUN cd / \
|
||||
&& wget http://v04.maxorator.com/server/VCMP04_server_v22_linux64.zip \
|
||||
&& unzip VCMP04_server_v22_linux64.zip \
|
||||
&& rm -f VCMP04_server_v22_linux64.zip \
|
||||
&& mkdir /vcmp \
|
||||
&& mv /mpsvrrel64 /vcmp/ \
|
||||
&& cd /vcmp \
|
||||
&& mkdir plugins \
|
||||
&& cd plugins \
|
||||
&& wget http://v04.maxorator.com/allplugins_04rel004_patch7.7z \
|
||||
&& p7zip -d allplugins_04rel004_patch7.7z \
|
||||
&& chmod 700 * \
|
||||
&& cd ../ \
|
||||
&& chmod 700 mpsvrrel64
|
||||
USER container
|
||||
ENV USER container
|
||||
ENV HOME /home/container
|
||||
ENV VCMP_VERSION v22
|
||||
ENV VCMP_PLUGIN_PATCH patch7
|
||||
|
||||
COPY vcmp.sh /usr/local/bin/vcmp
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
WORKDIR /home/container
|
||||
|
||||
RUN chmod +x /usr/local/bin/vcmp \
|
||||
&& chmod +x /entrypoint.sh
|
||||
COPY ./start.sh /start.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["vcmp", "start"]
|
||||
|
||||
EXPOSE 8192/udp
|
||||
CMD ["/bin/bash", "/start.sh"]
|
||||
|
@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$1" = 'vcmp' ]; then
|
||||
# 1: Get environment variables -- printenv
|
||||
# 2: Filter all which start with SAMP_* -- grep '^VCMP_*'
|
||||
VcmpVars=`env | grep '^VCMP_*'`
|
||||
|
||||
# Hand over environment variables as arguments for easier handling
|
||||
# As values of environment variables may contain whitespaces the IFS needs to be overwritten
|
||||
OLDIFS=$IFS
|
||||
IFS=$'\n'
|
||||
OLDARGS=$*
|
||||
set ${VcmpVars:=""}
|
||||
|
||||
# 3: Loop through each of the variables
|
||||
for config in $*; do
|
||||
# 4: Split environment variable up in key-value by specifying the '='-char as separator
|
||||
key=`echo $config | cut -d\= -f1`
|
||||
value=`echo $config | cut -d\= -f2`
|
||||
|
||||
# 5: Extract the part after "SAMP_" as key
|
||||
key=${key:5}
|
||||
|
||||
# 6: Transform the key to lowercase
|
||||
key=`echo $key | tr '[:upper:]' '[:lower:]'`
|
||||
|
||||
# 7: Check if there's already a line with the respective key in the server.cfg
|
||||
# 7.1 - True: Replace the current value with the new value
|
||||
# 7.2 - False: Add new line to server.cfg with the key-value pair
|
||||
grep -q "$key" vcmp/server.cfg && \
|
||||
sed -i "s/$key .*/$key $value/" vcmp/server.cfg 2>/dev/null || \
|
||||
sed -i "$ a\\$key $value" vcmp/server.cfg 2>/dev/null
|
||||
done
|
||||
|
||||
IFS=$OLDIFS
|
||||
set $OLDARGS
|
||||
fi
|
||||
|
||||
exec "$@"
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd /vcmp
|
||||
case "$1" in
|
||||
'start')
|
||||
exec nohup ./mpsvrrel64
|
||||
;;
|
||||
'stop')
|
||||
exec killall mpsvrrel64
|
||||
;;
|
||||
'restart')
|
||||
killall mpsvrrel64
|
||||
sleep 1
|
||||
exec nohup ./mpsvrrel64
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start/stop/restart"
|
||||
exit 1
|
||||
esac
|
Loading…
Reference in New Issue
Block a user