commit ae65d713805a86cef8f0befc4bde6f6fab9f4240 Author: Chris Plaatjes Date: Mon Jul 11 17:07:23 2022 -0400 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32a18f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:focal + +COPY ./smp-server-ubuntu-20_04-x86-64 /app/smp-server +COPY ./entrypoint.sh /entrypoint.sh + +RUN apt-get update \ + && apt-get install -y openssl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +EXPOSE 5223 + +ENTRYPOINT [ "/bin/bash" ] +CMD [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..f035ce5 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Checks initialization status +if [ ! -f "/app/config/smp-server.ini" ] && [ ! -f "/etc/opt/simplex/smp-server.ini" ]; then + # If no configs are present, initialize + if [ "$UseIP" = true ]; then + ./smp-server init --ip $IP + elif [ "$UseIP" = false ]; then + ./smp-server init -n $FQDN + else + echo "UseIP is not defined!! Exiting..." + exit + fi + + mv /etc/opt/simplex/* /app/config/ + ln -s /app/config/* /etc/opt/simplex/ + +elif [ -f "/app/config/smp-server.ini" ] && [ ! -f "/etc/opt/simplex/smp-server.ini" ]; then + # If existing config exists, make a symbolic link + mkdir /etc/opt/simplex + ln -s /app/config/* /etc/opt/simplex/ + +fi + +./smp-server start