diff --git a/.env b/.env index c062d70..1fbf114 100644 --- a/.env +++ b/.env @@ -3,3 +3,6 @@ API_URL= API_MODEL= ANNOUNCEMENT_TEXT= API_TIMEOUT=60 +# 添加后端服务地址(请替换为你的实际公网IP或域名) +BACKEND_URL=http://localhost:8888 +LOGIN_PASSWORD= diff --git a/.env.example b/.env.example index 3e93267..3e626b0 100644 --- a/.env.example +++ b/.env.example @@ -4,14 +4,13 @@ API_URL= API_MODEL= API_TIMEOUT=60 -# 登录配置 -LOGIN_PASSWORD= - # 公告文本 ANNOUNCEMENT_TEXT=欢迎使用! # 后端服务地址(公网访问时需要设置为公网IP或域名) # 本地开发时可以使用:http://backend:8888 # 公网访问时使用:http://your_public_ip:8888 -BACKEND_URL=http://your_public_ip:8888 +BACKEND_URL=http://localhost:8888 +# 登录配置(为空时不需要登录,否则需要经过登录接口验证) +LOGIN_PASSWORD= diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 77e6ec2..85d9e65 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -26,10 +26,10 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf.template COPY --from=build-stage /app/dist /usr/share/nginx/html # 创建启动脚本 -RUN echo '#!/bin/sh \n\ -envsubst "\$BACKEND_URL" < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf \n\ -nginx -g "daemon off;"' > /docker-entrypoint.sh && \ -chmod +x /docker-entrypoint.sh +RUN echo '#!/bin/sh' > /docker-entrypoint.sh && \ + echo 'envsubst "$BACKEND_URL" < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf' >> /docker-entrypoint.sh && \ + echo 'nginx -g "daemon off;"' >> /docker-entrypoint.sh && \ + chmod +x /docker-entrypoint.sh # 暴露80端口 EXPOSE 80