From 788bac39a4c4535fda56da1b34afdf5af844ad3a Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Fri, 3 Nov 2023 16:11:11 -0700 Subject: [PATCH] Add entrypoint.sh so we don't have to wait 10 seconds to down our stack. Make scripts just run from each container's respective bin directory. Upgrade to node 18.18.2 and nvm 0.39.5. Remove unnecessary output. --- docker-compose.yml | 3 +-- files/bin/xml.sh | 1 - server/Dockerfile | 8 +++----- server/bin/entrypoint.sh | 3 +++ server/{ => bin}/start.sh | 0 web/Dockerfile | 12 +++++------- web/bin/entrypoint.sh | 3 +++ web/{ => bin}/start.sh | 0 8 files changed, 15 insertions(+), 15 deletions(-) create mode 100755 server/bin/entrypoint.sh rename server/{ => bin}/start.sh (100%) create mode 100755 web/bin/entrypoint.sh rename web/{ => bin}/start.sh (100%) diff --git a/docker-compose.yml b/docker-compose.yml index 0f50439..e4582f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,6 @@ services: - mods:/serverfiles/steamapps/workshop/content - mods:/mods - ./files:/files - - ./web/bin/dz:/usr/local/bin/dz - ./web:/web ports: - "8001:8001/tcp" @@ -54,7 +53,7 @@ services: - mpmissions:/serverfiles/mpmissions - profiles:/profiles - ./files:/files - - ./server/bin/dz:/usr/local/bin/dz + - ./server:/server # To have the server show up in the LAN tab of the DayZ launcher, # it must run under host mode. network_mode: host diff --git a/files/bin/xml.sh b/files/bin/xml.sh index 46bdf5d..3804546 100755 --- a/files/bin/xml.sh +++ b/files/bin/xml.sh @@ -9,7 +9,6 @@ ID=${1} if ! [ -f ${FILES}/mods/${ID}/xml.env ] then - echo "No xml.env exists for the ID ${ID}." exit 0 fi diff --git a/server/Dockerfile b/server/Dockerfile index 81d310b..dd52d48 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -31,7 +31,7 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 # Add our scripts directory to PATH -ENV PATH /files/bin:/server:${PATH} +ENV PATH /files/bin:/server/bin:${PATH} # Add py3rcon RUN cd /usr/local && git clone https://github.com/indepth666/py3rcon.git @@ -44,9 +44,6 @@ RUN groupadd -g ${USER_ID} user && \ mkdir -p /home/user /serverfiles/mpmissions /mods /mpmissions /profiles && \ chown -R user:user /home/user /serverfiles /mods /mpmissions /profiles -# Add our startup script, as this rarely changes. -COPY --chown=user:user start.sh /usr/local/bin/start.sh - # Use our non-privileged user USER user @@ -54,4 +51,5 @@ USER user WORKDIR /home/user # Run the server. -ENTRYPOINT ["start.sh"] +ENTRYPOINT ["entrypoint.sh"] +CMD ["start.sh"] diff --git a/server/bin/entrypoint.sh b/server/bin/entrypoint.sh new file mode 100755 index 0000000..a1be715 --- /dev/null +++ b/server/bin/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec "$@" diff --git a/server/start.sh b/server/bin/start.sh similarity index 100% rename from server/start.sh rename to server/bin/start.sh diff --git a/web/Dockerfile b/web/Dockerfile index 14d9bfa..6340d51 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -39,16 +39,16 @@ ENV LC_ALL en_US.UTF-8 # Steamcmd needs its path added, as it ends up in /usr/games. # Our server script is bind mounted in /files in docker-compose. -ENV PATH /usr/games:/files/bin:/web:${PATH} +ENV PATH /usr/games:/files/bin:/web/bin:${PATH} # Install nodejs RUN mkdir /usr/local/nvm ENV NVM_DIR /usr/local/nvm -ENV NODE_VERSION 16.17.0 +ENV NODE_VERSION 18.18.2 RUN echo $NODE_VERSION # Install nvm with node and npm -RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \ +RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ && . $NVM_DIR/nvm.sh \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION \ @@ -71,9 +71,6 @@ RUN groupadd -g ${USER_ID} user && \ # Shut steamcmd up RUN cd /usr/lib/i386-linux-gnu && ln -s /web/bin/steamservice.so -# Add our startup script, as this rarely changes. -COPY --chown=user:user start.sh /usr/local/bin/start.sh - # Use our non-privileged user USER user @@ -81,4 +78,5 @@ USER user WORKDIR /home/user # Run the web server -ENTRYPOINT ["start.sh"] +ENTRYPOINT ["entrypoint.sh"] +CMD ["start.sh"] diff --git a/web/bin/entrypoint.sh b/web/bin/entrypoint.sh new file mode 100755 index 0000000..a1be715 --- /dev/null +++ b/web/bin/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec "$@" diff --git a/web/start.sh b/web/bin/start.sh similarity index 100% rename from web/start.sh rename to web/bin/start.sh