基于七牛云 goc 工具,使用 docker-compose 的方式编排,多个 app 服务共用一个 goc server。
其中,simple-go-server 我改成了动态指定端口启动,避免多个 app 启动端口冲突。
在此,也向项目推广者 @CarlJi 和项目的所有 contributors 致敬。
git clone https://github.com/ShaoNianyr/goc-docker
cd goc-docker
docker-compose up -d
docker-compose logs
version: '2'
services:
goc:
image: shaonian/goc:v1.0
network_mode: host
ports:
- "7777:7777"
command:
- ./goc
- server
app_1:
image: shaonian/simple-go-server:v1.0
restart: always
network_mode: host
ports:
- "5000:5000"
command:
- ./simple-go-server
- :5000
depends_on:
- goc
app_2:
image: shaonian/simple-go-server:v1.0
restart: always
network_mode: host
ports:
- "5001:5001"
command:
- ./simple-go-server
- :5001
depends_on:
- goc