You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
besure_web/Dockerfile

25 lines
654 B
Docker

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 使用轻量级的 Nginx 镜像
FROM nginx:alpine
ARG NGINX_CONF=nginx.conf
RUN rm -f /etc/nginx/conf.d/default.conf
COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf
COPY dist /usr/share/nginx/html
EXPOSE 8088
# 安装 getent 依赖Alpine 自带)
# 创建启动脚本:轮询等待后端 DNS 解析成功后再启动 nginx
RUN printf "#!/bin/sh\n\
echo \"Waiting for upstream besure-server-inner to resolve...\"\n\
while ! getent hosts besure-server-inner > /dev/null 2>&1; do\n\
sleep 2\n\
done\n\
echo \"Upstream resolved! Starting nginx...\"\n\
nginx -g \"daemon off;\"\n" > /start.sh && \
chmod +x /start.sh
CMD ["/start.sh"]