#765 Fix docker startup

This commit is contained in:
Cohee 2023-07-23 16:52:25 +03:00
parent ef3c8a19fe
commit ed86e8de04
4 changed files with 22 additions and 4 deletions

2
.gitignore vendored
View File

@ -14,7 +14,7 @@ public/stats.json
/uploads/ /uploads/
*.jsonl *.jsonl
/config.conf /config.conf
/docker/config.conf /docker/config
.DS_Store .DS_Store
public/settings.json public/settings.json
/thumbnails /thumbnails

View File

@ -23,13 +23,17 @@ COPY . ./
# Copy default chats, characters and user avatars to <folder>.default folder # Copy default chats, characters and user avatars to <folder>.default folder
RUN \ RUN \
IFS="," RESOURCES="characters,chats,groups,group chats,User Avatars,worlds,settings.json" && \ IFS="," RESOURCES="characters,chats,groups,group chats,User Avatars,worlds" && \
\ \
echo "*** Store default $RESOURCES in <folder>.default ***" && \ echo "*** Store default $RESOURCES in <folder>.default ***" && \
for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done && \ for R in $RESOURCES; do mv "public/$R" "public/$R.default"; done && \
\ \
echo "*** Create symbolic links to config directory ***" && \ echo "*** Create symbolic links to config directory ***" && \
for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done && \ for R in $RESOURCES; do ln -s "../config/$R" "public/$R"; done && \
# rm "config.conf" "public/settings.json" "public/css/bg_load.css" && \
ln -s "./config/config.conf" "config.conf" && \
ln -s "../config/settings.json" "public/settings.json" && \
ln -s "../../config/bg_load.css" "public/css/bg_load.css" && \
mkdir "config" mkdir "config"
# Cleanup unnecessary files # Cleanup unnecessary files

View File

@ -9,5 +9,4 @@ services:
- "8000:8000" - "8000:8000"
volumes: volumes:
- "./config:/home/node/app/config" - "./config:/home/node/app/config"
- "./config.conf:/home/node/app/config.conf"
restart: unless-stopped restart: unless-stopped

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Initialize missing user files # Initialize missing user files
IFS="," RESOURCES="characters,groups,group chats,chats,User Avatars,worlds,settings.json" IFS="," RESOURCES="characters,groups,group chats,chats,User Avatars,worlds"
for R in $RESOURCES; do for R in $RESOURCES; do
if [ ! -e "config/$R" ]; then if [ ! -e "config/$R" ]; then
echo "Resource not found, copying from defaults: $R" echo "Resource not found, copying from defaults: $R"
@ -9,5 +9,20 @@ for R in $RESOURCES; do
fi fi
done done
if [ ! -e "config/config.conf" ]; then
echo "Resource not found, copying from defaults: config.conf"
cp -r "default/config.conf" "config/config.conf"
fi
if [ ! -e "config/settings.json" ]; then
echo "Resource not found, copying from defaults: settings.json"
cp -r "default/settings.json" "config/settings.json"
fi
if [ ! -e "config/bg_load.css" ]; then
echo "Resource not found, copying from defaults: bg_load.css"
cp -r "default/bg_load.css" "config/bg_load.css"
fi
# Start the server # Start the server
exec node server.js exec node server.js