zoukankan      html  css  js  c++  java
  • window10 dockerfile创建vue项目,上传私库

    一、创建nginx镜像(必须是window10本地安装了Docker for Windows,没安装的可以参照:https://www.cnblogs.com/airen123/p/14785230.html

    1.  在window本地vue项目dist同目录下创建Dockefile文件,用来打包docker镜像:
    FROM nginx
    ENV TimeZone=Asia/Shanghai
    RUN mkdir /etc/nginx/logs
    COPY dist/ /etc/nginx/html
    COPY nginx.conf /etc/nginx/nginx.conf

          2. 创建nginx.conf 配置文件

    server {  
        listen       80;  
        server_name  localhost;  
      
        #charset koi8-r;  
        #access_log  /var/log/nginx/log/host.access.log  main;  
      
        location / {  
            #root   /etc/nginx/html;  
            root   /etc/nginx/html;  
            index  index.html index.htm;  
            #autoindex  on;  
            #try_files $uri /index/index/page.html;  
            #try_files $uri /index/map/page.html;  
        }  
       location /api/ {
                    proxy_redirect       off;
                    proxy_pass          http://localhost:9090/; #vue项目后端地址
                    proxy_set_header    X-Real-IP $remote_addr;
                    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header    Host $http_host;
            }
        #error_page  404              /404.html;  
      
        # redirect server error pages to the static page /50x.html  
        #  
        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   /usr/share/nginx/html;  
        }  
      
        
    }

     3.  cmd  本地dist路径,创建镜像(不要忘记命令是以点结尾的):

    docker build  -t   nginx:latest .

    4. 修改镜像名称tag,10.10.123.1:5000是私服地址:

    docker tag   nginx:latest    10.10.123.1:5000/nginx:latest

    5.  上传镜像到私服(如果需要登录,请先登录docker login   输入用户名和密码):

    docker  push  10.10.123.1:5000/nginx:latest

    6. 查看私服项目:

     curl  http://10.10.123.1:5000/v2/_catalog

    7. 下载私服上的镜像:

    docker  pull   10.10.123.1:5000/nginx:latest
  • 相关阅读:
    进程池-非阻塞式
    进程
    单例模式
    Python内置函数之open()
    Python内置函数之len()
    Python内置函数之isinstance()
    Python内置函数之input()
    可迭代对象,迭代器(生成器)区别
    Tomcat控制台输出
    Python内置函数之format()
  • 原文地址:https://www.cnblogs.com/airen123/p/14785392.html
Copyright © 2011-2022 走看看