签入版本
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# 使用官方Nginx Alpine基础镜像(更轻量)
|
||||
FROM nginx:1.24-alpine
|
||||
|
||||
# 维护者信息
|
||||
LABEL maintainer="xiaomayicloud@163.com"
|
||||
LABEL description="Nginx 1.24 for Node.js frontend deployment"
|
||||
LABEL version="1.24"
|
||||
|
||||
# 安装必要的工具
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
bash \
|
||||
tzdata \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# 设置时区(可选,根据需要修改)
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# 创建应用目录
|
||||
RUN mkdir -p /app/dist && \
|
||||
mkdir -p /app/logs && \
|
||||
mkdir -p /app/conf
|
||||
|
||||
# 移除默认的Nginx配置
|
||||
RUN rm -rf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 复制自定义Nginx配置
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY conf.d/ /etc/nginx/conf.d/
|
||||
|
||||
# 复制健康检查脚本
|
||||
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
|
||||
RUN chmod +x /usr/local/bin/healthcheck.sh
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80 443
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD /usr/local/bin/healthcheck.sh
|
||||
|
||||
# 启动Nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user