0%

docker-compose常用配置

version: '3'
services:
  nginx-route:
    image: hub.deri.org.cn/library/nginx
    container_name: nginx-route
    ports:
    - "8080:80"
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
    - "/wuzhiyong/nginx.conf:/etc/nginx/nginx.conf"
  authservice:
    image: wuzhiyong/authservice
    container_name: authservice
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
  dbcompare:
    image: wuzhiyong/dbcompare
    container_name: dbcompare
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
  graphcompare:
    image: wuzhiyong/graphcompare
    container_name: graphcompare
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
    - "/wuzhiyong/svg:/root/svg"
  hbasecompare:
    image: wuzhiyong/hbasecompare
    container_name: hbasecompare
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
    extra_hosts:
    - "hadoop1:172.16.0.7"
    - "hadoop2:172.16.0.8"
    - "hadoop3:172.16.0.9"
  taskservice:
    image: wuzhiyong/taskservice
    container_name: taskservice
    restart: always
    volumes:
    - "/etc/localtime:/etc/localtime"
networks:
  nwzb:
user  nginx;
worker_processes  1;

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


events {
    worker_connections  1024;
}


http {
    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;

    upstream taskservice{
        server taskservice:28080;
    }

    upstream authservice{
        server authservice:25050;
    }

    upstream dbcompare{
        server dbcompare:28082;
    }

    upstream hbasecompare{
        server hbasecompare:26060;
    }

    upstream graphcompare{
        server graphcompare:29090;
    }

    server {
        listen    80 default_server;
        server_name _;
    location /ts {
        proxy_pass    http://taskservice;
    }
        location /auth {
            proxy_pass  http://authservice;
        }
        location /dbc {
            proxy_pass  http://dbcompare;
        }
        location /hbc {
            proxy_pass  http://hbasecompare;
        }
        location /graph {
            proxy_pass  http://graphcompare;
        }
    }
}