update Dockerfile

This commit is contained in:
LittleBoy 2024-08-12 21:24:05 +08:00
parent bfa104a634
commit bdb44da1ea

View File

@ -32,12 +32,12 @@ WORKDIR /app
ENV APP_API_URL localhost:50000 ENV APP_API_URL localhost:50000
# nginx配置文件 # nginx配置文件
COPY nginx.conf /etc/nginx/conf.d/default.conf.template #COPY nginx.conf /etc/nginx/conf.d/default.conf.template
# 编译文件 # 编译文件
COPY --from=builder /app/dist ./ COPY --from=builder /app/dist ./
# RUN /bin/sh envsubst /etc/nginx/templates/*.template /etc/nginx/conf.d # RUN /bin/sh envsubst /etc/nginx/templates/*.template /etc/nginx/conf.d
WORKDIR /etc/nginx/conf.d/ #WORKDIR /etc/nginx/conf.d/
ENTRYPOINT sed -i "s~<!--app_url-->~<script>const APP_SITE_URL='${APP_SITE_URL}';</script>~" /app/index.html && envsubst '$APP_API_URL' < default.conf.template > default.conf && cat default.conf && nginx -g 'daemon off;' #ENTRYPOINT sed -i "s~<!--app_url-->~<script>const APP_SITE_URL='${APP_SITE_URL}';</script>~" /app/index.html && envsubst '$APP_API_URL' < default.conf.template > default.conf && cat default.conf && nginx -g 'daemon off;'
# 暴露80端口 # 暴露80端口
EXPOSE 80 EXPOSE 80
# 启动Nginx服务 # 启动Nginx服务