Concise Dockerfile and entrypoint

This commit is contained in:
Grzegorz Gidel
2023-04-30 16:23:36 +02:00
parent a772cf5aee
commit ebe1ee20d1
2 changed files with 15 additions and 34 deletions

View File

@ -1,28 +1,13 @@
#!/bin/sh
# Check if the "characters" directory is empty
if [ ! -e "/home/node/app/config/characters" ]; then
echo "Characters directory not found. Copying default characters."
mv /home/node/app/public/characters.default /home/node/app/config/characters
fi
# Check if the "chats" directory is empty
if [ ! -e "/home/node/app/config/chats" ]; then
echo "Chats directory not found. Copying default chats."
mv /home/node/app/public/chats.default /home/node/app/config/chats/
fi
# Check if the "User Avatars" directory is empty
if [ ! -e "/home/node/app/config/User Avatars" ]; then
echo "User Avatars directory not found. Copying default user avatars."
mv /home/node/app/public/User\ Avatars.default /home/node/app/config/User\ Avatars/
fi
# Check if the "settings.json" file is not empty
if [ ! -e "/home/node/app/config/settings.json" ]; then
echo "Settings file not found. Copying default settings."
mv /home/node/app/public/settings.json.default /home/node/app/config/settings.json
fi
# Initialize missing user files
IFS="," RESOURCES="characters,chats,User Avatars,settings.json"
for R in $RESOURCES; do
if [ ! -e "config/$R" ]; then
echo "Resource not found, copying from defaults: $R"
cp -r "public/$R.default" "config/$R"
fi
done
# Start the server
exec node /home/node/app/server.js
exec node server.js