文章目录
Dockerfile
用于生成镜像的文件
FROM nginx:1.17.9 //基础镜像
ENV LANG=en_US.UTF-8
ENV TZ=Asia/Shanghai
COPY src/dist /opt/map //把打包后生产的dist文件夹,复制到.../map 目录下
COPY config/map_client_web_nginx.template /opt/config/map_client_web_nginx.template
COPY config/config.template /opt/config/config.template
RUN touch /etc/nginx/conf.d/map_client_web_nginx.conf //新建一个nginx的配置文件,此时文件还是空的
CMD ["/bin/bash", "-c", "envsubst </opt/config/map_client_web_nginx.template > /etc/nginx/conf.d/map_client_web_nginx.conf && envsubst </opt/config/config.template > /opt/map/static/json/config.json && nginx -g 'daemon off;'"]
//CMD docker run时执行命令,参数用,分割
//生成nginx配置文件并替换
docker-compose.yml
用来启动容器的文件
用这个文件直接启动,docker-compose up,就不用再用docker run 之类的指令了
version: '3'
services:
XXXX:
image: test_docker:1.00
e