From ab8baf6994f7ee552b7ef0424a02a9a7cc7628de Mon Sep 17 00:00:00 2001 From: Jeremiah Blanchard Date: Sun, 4 Apr 2021 15:29:23 -0400 Subject: [PATCH 1/3] Added bootstrap to vanilla to enable use of environment variables for default world loading --- vanilla/Dockerfile | 9 ++++++++- vanilla/bootstrap.sh | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 vanilla/bootstrap.sh diff --git a/vanilla/Dockerfile b/vanilla/Dockerfile index 5ce26b8..6dd9bbc 100644 --- a/vanilla/Dockerfile +++ b/vanilla/Dockerfile @@ -20,8 +20,15 @@ LABEL maintainer="Ryan Sheehan " EXPOSE 7777 +# env used in the bootstrap +ENV CONFIGPATH=/root/.local/share/Terraria/Worlds +ENV WORLD_FILENAME="" + VOLUME ["/root/.local/share/Terraria/Worlds", "/config"] COPY --from=base /terraria-server/ /terraria-server/ -ENTRYPOINT ["/terraria-server/TerrariaServer"] +# add the bootstrap file +COPY bootstrap.sh /terraria-server/bootstrap.sh + +ENTRYPOINT ["/terraria-server/bootstrap.sh"] diff --git a/vanilla/bootstrap.sh b/vanilla/bootstrap.sh new file mode 100644 index 0000000..5f28fd4 --- /dev/null +++ b/vanilla/bootstrap.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ -z "$WORLD_FILENAME" ]; then + /terraria-server/TerrariaServer -world $@ +else + /terraria-server/TerrariaServer -world $CONFIGPATH/$WORLD_FILENAME $@ +fi From f0c3e6ebe569318b60c183c3af6885d75cb7bb08 Mon Sep 17 00:00:00 2001 From: Jeremiah Blanchard Date: Sun, 4 Apr 2021 15:38:20 -0400 Subject: [PATCH 2/3] Added executable update for safety --- vanilla/Dockerfile | 2 +- vanilla/bootstrap.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 vanilla/bootstrap.sh diff --git a/vanilla/Dockerfile b/vanilla/Dockerfile index 6dd9bbc..8e94327 100644 --- a/vanilla/Dockerfile +++ b/vanilla/Dockerfile @@ -30,5 +30,5 @@ COPY --from=base /terraria-server/ /terraria-server/ # add the bootstrap file COPY bootstrap.sh /terraria-server/bootstrap.sh - +RUN chmod +x /terraria-server/bootstrap.sh ENTRYPOINT ["/terraria-server/bootstrap.sh"] diff --git a/vanilla/bootstrap.sh b/vanilla/bootstrap.sh old mode 100644 new mode 100755 From a24bd2194cbaf051d89a9bfa89481ff466f6c0c2 Mon Sep 17 00:00:00 2001 From: doctorjei Date: Mon, 5 Apr 2021 12:07:10 -0400 Subject: [PATCH 3/3] Update bootstrap.sh Fixed bug when no WORLD_FILENAME is provided --- vanilla/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vanilla/bootstrap.sh b/vanilla/bootstrap.sh index 5f28fd4..33c6ed2 100755 --- a/vanilla/bootstrap.sh +++ b/vanilla/bootstrap.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ -z "$WORLD_FILENAME" ]; then - /terraria-server/TerrariaServer -world $@ + /terraria-server/TerrariaServer $@ else /terraria-server/TerrariaServer -world $CONFIGPATH/$WORLD_FILENAME $@ fi