#version: '3.9' services: nginx: restart: always container_name: nginx image: nginx # build: # context: ./nginx ports: - "80:80" volumes: - /home/docker/nginx/html/web-mobile:/home/web-mobile - /home/docker/nginx/logs:/var/log/nginx - /home/docker/nginx/conf.d:/etc/nginx/conf.d - /home/docker/nginx/ssl:/www/nginx networks: - my_custom_network # depends_on: # - certbot # # certbot: # image: certbot/certbot # volumes: # - /home/docker/nginx/ssl/:/etc/letsencrypt # - /home/docker/nginx/html:/var/www/html # command: > # sh -c "trap exit TERM; while :; do certbot renew --webroot --webroot-path=/var/www/html --quiet; sleep 12h & wait $$!; done;" # networks: # - my_custom_network etcd: image: bitnami/etcd:latest container_name: etcd environment: - ALLOW_NONE_AUTHENTICATION=yes - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379 ports: - "2379:2379" - "2380:2380" restart: always networks: - my_custom_network redis: image: redis:latest container_name: redis ports: - "6379:6379" command: ["redis-server", "--appendonly", "yes"] restart: always networks: - my_custom_network mongodb: image: mongo:latest container_name: mongodb # environment: # - MONGO_INITDB_ROOT_USERNAME=admin # - MONGO_INITDB_ROOT_PASSWORD=123456 ports: - "27017:27017" volumes: - mongo_data:/data/db restart: always networks: - my_custom_network nats: image: nats:latest container_name: nats ports: - "4222:4222" - "8222:8222" - "6222:6222" restart: always networks: - my_custom_network center: build: context: ./center dockerfile: Dockerfile container_name: center # ports: # - "8080:8080" environment: - GO_ENV=development # 可以根据需要设置环境变量 - NATS_URL=nats://127.0.0.1:4222 # 确保这个环境变量存在 volumes: - .:/app # 如果需要将本地代码挂载到容器中进行开发 - ./config:/config # 挂载宿主机的配置文件目录到容器内的 /config restart: always networks: - my_custom_network game: build: context: ./game dockerfile: Dockerfile container_name: game # ports: # - "8080:8080" environment: - GO_ENV=development # 可以根据需要设置环境变量 volumes: - .:/app # 如果需要将本地代码挂载到容器中进行开发 - ./config:/config # 挂载宿主机的配置文件目录到容器内的 /config restart: always networks: - my_custom_network master: build: context: ./master dockerfile: Dockerfile container_name: master # ports: # - "8080:8080" environment: - GO_ENV=development # 可以根据需要设置环境变量 volumes: - .:/app # 如果需要将本地代码挂载到容器中进行开发 - ./config:/config # 挂载宿主机的配置文件目录到容器内的 /config restart: always networks: - my_custom_network web: build: context: ./web dockerfile: Dockerfile container_name: web ports: - "20000:20000" environment: - GO_ENV=development # 可以根据需要设置环境变量 volumes: - .:/app # 如果需要将本地代码挂载到容器中进行开发 - ./config:/config # 挂载宿主机的配置文件目录到容器内的 /config restart: always networks: - my_custom_network volumes: mongo_data: networks: my_custom_network: driver: bridge