# 使用基于Alpine的官方Nginx镜像 FROM nginx:alpine # 创建缓存目录并赋予适当的权限 RUN mkdir -p /var/cache/nginx/client_temp && \ mkdir -p /var/cache/nginx/proxy_temp && \ mkdir -p /var/cache/nginx/fastcgi_temp && \ mkdir -p /var/cache/nginx/scgi_temp && \ mkdir -p /var/cache/nginx/uwsgi_temp && \ chown -R nginx:nginx /var/cache/nginx #配置 COPY nginx.conf /etc/nginx/nginx.conf COPY . /usr/share/nginx/html # 设置工作目录的权限 RUN chown -R nginx:nginx /usr/share/nginx/html # 设置用户为nginx,以确保以正确的权限运行 USER nginx # 暴露必要的端口 EXPOSE 7860 # 启动Nginx CMD ["nginx", "-g", "daemon off;"]