mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 14:21:18 +00:00
Switch from CMD to ENTRYPOINT, then use exec in both start.sh scripts, so process id 1 can be the process it needs to be, as this is what gets SIGTERM on docker compose down.
We now get a .bashrc by default, so switch the logic to detecting the custom PS1 before putting it in .bashrc. Account for a directory that steamcmd expects.
This commit is contained in:
parent
f153f3db18
commit
4c09ef752c
5 changed files with 22 additions and 9 deletions
|
@ -54,4 +54,4 @@ USER user
|
|||
WORKDIR /home/user
|
||||
|
||||
# Run the server.
|
||||
CMD ["start.sh"]
|
||||
ENTRYPOINT ["start.sh"]
|
||||
|
|
|
@ -242,7 +242,7 @@ mergexml(){
|
|||
# Start the server in the foreground
|
||||
start(){
|
||||
# Ensure mpmissions has at least one map. If not, copy it from the local read-only volume that stores pristine mpmissons directories
|
||||
if [ ! -d "${MPMISSIONS}/${MAP}" ]
|
||||
if [ ! -d "${MPMISSIONS}/${MAP}" ] && [ -d "/mpmissions/${MAP}" ]
|
||||
then
|
||||
echo
|
||||
echo "Performing one-time copy of ${MAP} mpmissions..."
|
||||
|
@ -253,7 +253,14 @@ start(){
|
|||
if [[ ${DEVELOPMENT} = "1" ]]
|
||||
then
|
||||
echo "DEVELOPMENT mode, blocking. Unset DEVELOPMENT in the current environment to run the server."
|
||||
tail -f /dev/null
|
||||
trap '
|
||||
echo "Caught SIGTERM/SIGINT..."
|
||||
exit 0
|
||||
' SIGTERM SIGINT
|
||||
while true
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
# Do the report on exit. Set here so that it only happens once we're starting the server, and not for other actions.
|
||||
|
|
|
@ -8,4 +8,4 @@ EOF
|
|||
|
||||
# Start the server.
|
||||
# If the DEVELOPMENT environment variable is set to 1, the container will just block and not start the server.
|
||||
dz start
|
||||
exec dz start
|
||||
|
|
|
@ -81,4 +81,4 @@ USER user
|
|||
WORKDIR /home/user
|
||||
|
||||
# Run the web server
|
||||
CMD ["start.sh"]
|
||||
ENTRYPOINT ["start.sh"]
|
||||
|
|
14
web/start.sh
14
web/start.sh
|
@ -1,15 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Set PS1 so we know we're in the container
|
||||
if ! [ -f .bashrc ]
|
||||
if ! echo .bashrc | grep -q "dz-web"
|
||||
then
|
||||
echo "Creating .bashrc..."
|
||||
cat > .bashrc <<EOF
|
||||
echo "Adding PS1 to .bashrc..."
|
||||
cat >> .bashrc <<EOF
|
||||
alias ls='ls --color'
|
||||
export PS1="${debian_chroot:+($debian_chroot)}\u@dz-web:\w\$ "
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Shut steamcmd up
|
||||
if ! [ -d ${HOME}/.steam ]
|
||||
then
|
||||
mkdir -p ${HOME}/.steam
|
||||
fi
|
||||
|
||||
cd /web
|
||||
npm i
|
||||
export DEBUG='express:*'
|
||||
|
@ -17,4 +23,4 @@ npx nodemon web.js &
|
|||
|
||||
cd docroot
|
||||
npm i
|
||||
npm run dev
|
||||
exec npm run dev
|
||||
|
|
Loading…
Add table
Reference in a new issue