diff --git a/apps/blogai/Dockerfile b/apps/blogai/Dockerfile index 944e50f..45e5860 100644 --- a/apps/blogai/Dockerfile +++ b/apps/blogai/Dockerfile @@ -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 diff --git a/supervisor.conf b/supervisor.conf index 41b9f22..8b49f6a 100644 --- a/supervisor.conf +++ b/supervisor.conf @@ -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 diff --git a/wrapper.sh b/wrapper.sh new file mode 100644 index 0000000..53a3280 --- /dev/null +++ b/wrapper.sh @@ -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 < "$ENV_FILE" +window.RUNTIME_ENV = { + "SUPABASE_URL": "${SUPABASE_URL}" +}; +EOF + +cd /plugai/zerostack/t1 +exec npm run start