19 lines
572 B
Docker
19 lines
572 B
Docker
FROM nginx:alpine
|
||
|
||
# 删除默认配置
|
||
RUN rm /etc/nginx/conf.d/default.conf
|
||
|
||
|
||
# 将本地 nginx 配置复制到镜像中
|
||
COPY ./conf.c/ /etc/nginx/conf.c/
|
||
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||
COPY ./sites-enabled/ /etc/nginx/sites-enabled/
|
||
|
||
# 暴露端口
|
||
EXPOSE 80 443
|
||
|
||
# 直接在Dockerfile中执行权限设置,不使用entrypoint.sh
|
||
RUN mkdir -p /var/log/nginx && chmod -R 0444 /etc/nginx/conf.c && chmod 0444 /etc/nginx/conf.d/default.conf && chmod -R 0755 /etc/nginx/sites-enabled
|
||
|
||
# 启动nginx
|
||
CMD ["nginx", "-g", "daemon off;"] |