This commit is contained in:
hailin 2025-06-14 22:55:08 +08:00
parent 67c8df29e0
commit 80c79cd779
3 changed files with 46 additions and 2 deletions

View File

@ -55,6 +55,10 @@ COPY --from=builder /app/apps/blogai/public ./public
COPY --from=builder /app/apps/blogai/next.config.js ./next.config.js
COPY --from=builder /app/apps/blogai/next-i18next.config.js ./next-i18next.config.js
# 确保 wrapper.sh 可执行权限
COPY ./wrapper.sh /plugai/wrapper.sh
RUN chmod +x /plugai/wrapper.sh
RUN rm -rf /root/.npm /root/.pnpm-store /tmp/*
EXPOSE 3008

View File

@ -1,5 +1,20 @@
[web]
command=npm start
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
pidfile=/tmp/supervisord.pid
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:web]
command=/plugai/wrapper.sh
directory=/plugai/zerostack/t1
autostart=true
autorestart=true

25
wrapper.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# ✅ 设置 SUPABASE_URL如果为空则使用默认值
if [ -z "${SUPABASE_URL:-}" ]; then
SUPABASE_URL="http://localhost:8000"
fi
# ✅ 删除旧的 env.js如果存在
ENV_FILE="/supabase/chatdesk/public/env.js"
if [ -f "$ENV_FILE" ]; then
echo "[chatdesk-ui] Removing old env.js"
rm -f "$ENV_FILE"
fi
# ✅ 写入新的 env.js
echo "[chatdesk-ui] Writing env.js with SUPABASE_URL=$SUPABASE_URL"
cat <<EOF > "$ENV_FILE"
window.RUNTIME_ENV = {
"SUPABASE_URL": "${SUPABASE_URL}"
};
EOF
cd /plugai/zerostack/t1
exec npm run start