fix: 修复后端启动脚本

This commit is contained in:
CaasianVale
2025-03-07 15:30:24 +08:00
parent d1feaef434
commit a567925bbc
3 changed files with 10 additions and 8 deletions

3
.env
View File

@@ -3,3 +3,6 @@ API_URL=
API_MODEL=
ANNOUNCEMENT_TEXT=
API_TIMEOUT=60
# 添加后端服务地址请替换为你的实际公网IP或域名
BACKEND_URL=http://localhost:8888
LOGIN_PASSWORD=

View File

@@ -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=

View File

@@ -26,9 +26,9 @@ 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 && \
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端口