单页 - Dockerfile构建

1、项目工程中新建文件夹docker目录

git clone https://xx.xx.com/example.git
cd example 
mkdir docker
cd docker
touch Dockerfile
touch nginx.conf
  • Dockerfile
FROM XX-new-centos6-nginx
RUN mkdir -p /app
COPY ./dist /app
COPY ./docker/nginx.conf /opt/nginx/conf/domains
WORKDIR /app
ENTRYPOINT mkdir -p /dev/shm/nginx_temp/client_body && mkdir -p /export/Logs/servers/nginx/logs && nginx -c /opt/nginx/conf/nginx.conf && sleep 9999999d
  • nginx.conf
  • history 模式
server {
  listen 80;
  server_name www.ww.com;
  location / {
    root /app;
    expires 1d;
    try_files $uri $uri/ /index.html;
  }
}
  • hash模式
server {
  listen 80;
  server_name www.ww.com;
  location / {
    root /app;
    expires 1d;
  }
}

2、使用Dockerfile构建

  • 基础镜像: XX-new-centos6-nginx [对应Dockerfile中 FORM]
  • 源码地址: https://xx.xx.com/example.git [你要部署的git地址仓库]
  • Git信息: 对应部署分支
  • Dockerfile路径: docker/Dockerfile
  • 然后点击立即构建即可构建前端docker镜像

写代码的小可爱
7 声望1 粉丝

写代码的小可爱❤️