Dockerfile 557 B

123456789101112131415161718
  1. # 使用官方nginx镜像作为基础
  2. FROM nginx:1.27.0
  3. # 复制测试用的nginx配置
  4. COPY nginx-test.conf /etc/nginx/conf.d/default.conf
  5. # 创建测试目录结构
  6. RUN mkdir -p /usr/share/nginx/html/test && \
  7. mkdir -p /usr/share/nginx/html/test/dir1/dir2 && \
  8. echo "test1" > /usr/share/nginx/html/test/file1.txt && \
  9. echo "test2" > /usr/share/nginx/html/test/file2.txt && \
  10. echo "nested" > /usr/share/nginx/html/test/dir1/dir2/file3.txt
  11. # 暴露80端口
  12. EXPOSE 80
  13. # 启动nginx并保持前台运行
  14. CMD ["nginx", "-g", "daemon off;"]