新容器 react tf

文章目录

  • 使用容器
  • nginx config
  • copy build
  • 替换
  • 成品镜像
  • 压缩 派出文件

使用容器

docker  run -d -p 20080:80 --name nginxCoCoTF  registry.cn-hangzhou.aliyuncs.com/mkmk/nginx:ReactCocoTF

nginx config

docker run -d -p 10080:80 --name nginx1 nginx

docker exec -it nginx1 /bin/bash

find / -name “nginx.conf

/etc/nginx/nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {

  server {
    listen       80;
    server_name  localhost;
    location / {
        root   /usr/share/nginx/html/build;
        index  index.html index.htm;
    }
  }

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

copy build

docker cp build/ nginx1:/usr/share/nginx/html/build

替换

sed -i ‘s?/usr/share/nginx/html?/usr/share/nginx/html/build?g’ /etc/nginx/nginx.conf
cat < /etc/nginx/nginx.conf

成品镜像

registry.cn-hangzhou.aliyuncs.com/mkmk/nginx:ReactCocoTF

docker run -d -p 20080:80 --name nginxCoCoTF registry.cn-hangzhou.aliyuncs.com/mkmk/nginx:ReactCocoTF

压缩 派出文件

zip -r 压缩目录.zip 源目录/ -x 排出的目录 -x “cloud_backweb/download/wordfile/*”

你可能感兴趣的:(新容器 react tf)