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.
This commit is contained in:
Daniel Ceregatti 2023-11-03 16:11:11 -07:00
parent 81b096c320
commit 788bac39a4
8 changed files with 15 additions and 15 deletions

View file

@ -31,7 +31,6 @@ services:
- mods:/serverfiles/steamapps/workshop/content - mods:/serverfiles/steamapps/workshop/content
- mods:/mods - mods:/mods
- ./files:/files - ./files:/files
- ./web/bin/dz:/usr/local/bin/dz
- ./web:/web - ./web:/web
ports: ports:
- "8001:8001/tcp" - "8001:8001/tcp"
@ -54,7 +53,7 @@ services:
- mpmissions:/serverfiles/mpmissions - mpmissions:/serverfiles/mpmissions
- profiles:/profiles - profiles:/profiles
- ./files:/files - ./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, # To have the server show up in the LAN tab of the DayZ launcher,
# it must run under host mode. # it must run under host mode.
network_mode: host network_mode: host

View file

@ -9,7 +9,6 @@ ID=${1}
if ! [ -f ${FILES}/mods/${ID}/xml.env ] if ! [ -f ${FILES}/mods/${ID}/xml.env ]
then then
echo "No xml.env exists for the ID ${ID}."
exit 0 exit 0
fi fi

View file

@ -31,7 +31,7 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8 ENV LC_ALL en_US.UTF-8
# Add our scripts directory to PATH # Add our scripts directory to PATH
ENV PATH /files/bin:/server:${PATH} ENV PATH /files/bin:/server/bin:${PATH}
# Add py3rcon # Add py3rcon
RUN cd /usr/local && git clone https://github.com/indepth666/py3rcon.git 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 && \ mkdir -p /home/user /serverfiles/mpmissions /mods /mpmissions /profiles && \
chown -R user:user /home/user /serverfiles /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 # Use our non-privileged user
USER user USER user
@ -54,4 +51,5 @@ USER user
WORKDIR /home/user WORKDIR /home/user
# Run the server. # Run the server.
ENTRYPOINT ["start.sh"] ENTRYPOINT ["entrypoint.sh"]
CMD ["start.sh"]

3
server/bin/entrypoint.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
exec "$@"

View file

@ -39,16 +39,16 @@ ENV LC_ALL en_US.UTF-8
# Steamcmd needs its path added, as it ends up in /usr/games. # Steamcmd needs its path added, as it ends up in /usr/games.
# Our server script is bind mounted in /files in docker-compose. # 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 # Install nodejs
RUN mkdir /usr/local/nvm RUN mkdir /usr/local/nvm
ENV NVM_DIR /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 RUN echo $NODE_VERSION
# Install nvm with node and npm # 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_DIR/nvm.sh \
&& nvm install $NODE_VERSION \ && nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \ && nvm alias default $NODE_VERSION \
@ -71,9 +71,6 @@ RUN groupadd -g ${USER_ID} user && \
# Shut steamcmd up # Shut steamcmd up
RUN cd /usr/lib/i386-linux-gnu && ln -s /web/bin/steamservice.so 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 # Use our non-privileged user
USER user USER user
@ -81,4 +78,5 @@ USER user
WORKDIR /home/user WORKDIR /home/user
# Run the web server # Run the web server
ENTRYPOINT ["start.sh"] ENTRYPOINT ["entrypoint.sh"]
CMD ["start.sh"]

3
web/bin/entrypoint.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
exec "$@"