version: "2" services: redis: build: ./redis/ restart: always container_name: mac-redis identity: build: ~/identity/src/Web/ #identity项目的Dockerfile所在的目录 restart: always volumes: - ~/identity/src/Web/bin/Debug/netcoreapp1.1/publish:/app #把编译好的序集添加到数据卷中 links: - 'ucenter:api.ucenter.com' #因为identity项目依赖ucenter项目,identity目内部通过url:api.ucenter.com调用ucenter的webapi,所以这里要给设置一个和ur一样的别名,这样identity项目访问`api.ucenter.com`就会被转发到ucenter容器。 - redis extra_hosts: - "dbserver:192.168.199.143" #之前搭建了一个sqlserver容器,那个是单独放在个Linux机器里面,所以这里就直接通过地址调用,注意要开启远程访问。 container_name: identity logging: driver: "json-file" options: max-size: "50k" #因为随着程序的运行,日志会越来越多,导致每次加载时间越越长,所以规定日志文件大小,节省时间 max-file: "10" ucenter: build: ~/UCenter/src/WebAPI #ucenter项目的Dockerfile所在的目录 restart: always volumes: - ~/UCenter/src/WebAPI/bin/Debug/netcoreapp1.1/publish:/app links: - redis extra_hosts: - "dbserver:192.168.199.143" container_name: ucenter nginx-host: build: ./nginx #nginx的Dockerfile所在的目录 restart: always ports: - "80:80" #监听主机的80端口,或者其它的端口都可以 links: - identity - ucenter volumes: - ./nginx/sites-enabled:/etc/nginx/sites-enabled #nginx的配置文件放在据卷中,以后需要改动的时候,重启nginx就可以了,不用重新build - /WebCommon:/www/data #各个项目共用的静态文件,一般走cdn的,在开发环境里就nginx代理 container_name: nginx-host logging: driver: "json-file" options: max-size: "50k" max-file: "10"
server {
listen 80;
server_name account.xxx.com; #identity项目的域名
location / {
proxy_pass http://identity; # 转发到identity 服务处理
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 8m;
client_body_buffer_size 128;
}
}
server {
listen 80;
server_name ucenter.xxx.com; #ucenter项目的域名
location / {
proxy_pass http://ucenter; #转发到ucenter服务处理
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 8m;
client_body_buffer_size 128;
}
}
server {
listen 80;
server_name cdn.xxx.com; #这里把静态文件打包成一个服务,替代cdn
root /www/data;
location / {
}
}
FROM tutum/nginx VOLUME /etc/nginx/sites-enabled
FROM redis COPY redis.conf /usr/local/etc/redis/redis.conf CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
redis:6379> set key1 value1 OK redis:6379> get key1 "value1"
build: ~/identity/src/Web/ #identity项目的Dockerfile所在的目录
FROM microsoft/aspnetcore:1.1.1 LABEL Name= identity Version=0.0.1 ENV ASPNETCORE_ENVIRONMENT Development ENTRYPOINT ["dotnet", "Identity.Web.dll"]
FROM microsoft/aspnetcore:1.1.1 LABEL Name=ucenter Version=0.0.1 ENTRYPOINT ["dotnet", "UCenter.WebAPI.dll"]
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有