继续提交

This commit is contained in:
2025-12-13 21:33:26 +08:00
parent 7a731d44e3
commit fa77e0a65f
2215 changed files with 392858 additions and 2 deletions

28
start.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
# ensure data dir exists (mounted volume expected)
DATA_DIR=${DRIFT_BOTTLE_DATA_DIR:-/app/data}
mkdir -p "$DATA_DIR"
for json_file in bottles.json filter_words.json mottos.json config.json; do
if [ -f "/app/mengyadriftbottle-backend/${json_file}" ] && [ ! -f "$DATA_DIR/${json_file}" ]; then
cp "/app/mengyadriftbottle-backend/${json_file}" "$DATA_DIR/${json_file}"
fi
done
# start backend on localhost:5002 (not exposed outside container)
BACKEND_PORT=${BACKEND_PORT:-5002}
echo "Starting backend API on localhost:${BACKEND_PORT}"
cd /app/mengyadriftbottle-backend
gunicorn -b 127.0.0.1:${BACKEND_PORT} app:app &
BACKEND_PID=$!
# start nginx to serve frontend + proxy /api to backend
echo "Starting nginx on port 6767 (proxying /api to backend)"
nginx -g 'daemon off;' &
NGINX_PID=$!
trap "kill $BACKEND_PID $NGINX_PID" TERM INT
wait -n $BACKEND_PID $NGINX_PID