Skip to content

Commit

Permalink
Merge pull request #8 from voxelbonecloud/nice-shutdown
Browse files Browse the repository at this point in the history
enhancement: Add graceful shutdown to container
  • Loading branch information
bredo228 authored Jul 18, 2024
2 parents b67cdcd + 6fcba69 commit 9f47de5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ RUN apt update \
&& apt install curl lib32gcc-s1 libfreetype6 -y \
&& useradd -m -d /home/container -s /bin/bash container

COPY ./scripts /scripts

RUN chmod +x /scripts/*

RUN mkdir /Logs \
&& chown -R container:container /Logs

Expand All @@ -21,6 +25,7 @@ ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /home/container

COPY ./entrypoint.sh /entrypoint.sh
COPY ./scripts /scripts
CMD [ "/bin/bash", "/entrypoint.sh" ]
STOPSIGNAL SIGINT

ENTRYPOINT ["/scripts/update-resonite.sh"]
CMD ["/scripts/launch-resonite.sh"]
5 changes: 0 additions & 5 deletions entrypoint.sh

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/launch-resonite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ find /Logs -type f -name *.log -atime +${LOG_RETENTION:-30} -delete
cd /home/container/Headless/net8.0

if [ "${ENABLE_MODS}" = "true" ]; then
dotnet Resonite.dll -HeadlessConfig /Config/${CONFIG_FILE} -Logs /Logs/ -LoadAssembly Libraries/ResoniteModLoader.dll ${ADDITIONAL_ARGUMENTS}
exec dotnet Resonite.dll -HeadlessConfig /Config/${CONFIG_FILE} -Logs /Logs/ -LoadAssembly Libraries/ResoniteModLoader.dll ${ADDITIONAL_ARGUMENTS}
else
dotnet Resonite.dll -HeadlessConfig /Config/${CONFIG_FILE} -Logs /Logs/ ${ADDITIONAL_ARGUMENTS}
exec dotnet Resonite.dll -HeadlessConfig /Config/${CONFIG_FILE} -Logs /Logs/ ${ADDITIONAL_ARGUMENTS}
fi
6 changes: 0 additions & 6 deletions scripts/setup-steamcmd.sh

This file was deleted.

9 changes: 9 additions & 0 deletions scripts/update-resonite.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh

if [ ! -d "/home/container/steamcmd" ]; then
echo Installing steamcmd
mkdir -p /home/container/steamcmd
curl -sSL -o /tmp/steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xf /tmp/steamcmd.tar.gz --directory /home/container/steamcmd
fi

HEADLESS_DIRECTORY="/home/container/Headless/net8.0"

/home/container/steamcmd/steamcmd.sh +login ${STEAM_USER} ${STEAM_PASS} +force_install_dir /home/container +app_update 2519830 -beta ${STEAM_BRANCH} -betapassword ${BETA_CODE} +quit
Expand All @@ -23,3 +30,5 @@ if [ "${ENABLE_MODS}" = "true" ]; then
curl -SslL https://github.com/resonite-modding-group/ResoniteModLoader/releases/latest/download/ResoniteModLoader.dll -o ${HEADLESS_DIRECTORY}/Libraries/ResoniteModLoader.dll

fi

exec $*

0 comments on commit 9f47de5

Please sign in to comment.