feat: 完成 Docker Compose 生产/开发编排文件,统一全项目镜像版本

This commit is contained in:
fish
2026-03-28 18:18:16 +08:00
parent 2f55987222
commit 126e1f8466
3 changed files with 143 additions and 1 deletions

View File

@@ -0,0 +1,79 @@
version: '3.8'
services:
nginx:
image: nginx:1.25-alpine
ports:
- "80:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- gateway
networks:
- backend-network
gateway:
build:
context: ./gateway
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
- GO_ENV=development
- REDIS_ADDR=redis:6379
volumes:
- ./gateway:/app
depends_on:
- redis
networks:
- backend-network
user-svc:
build:
context: ./services/user-svc
dockerfile: Dockerfile
ports:
- "50051:50051"
environment:
- GO_ENV=development
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=password
- POSTGRES_DB=userdb
volumes:
- ./services/user-svc:/app
depends_on:
- postgres
networks:
- backend-network
postgres:
image: postgres:18.3-alpine3.23
ports:
- "5432:5432"
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=password
- POSTGRES_DB=userdb
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- backend-network
redis:
image: redis:8.6.2-alpine
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- backend-network
volumes:
postgres-data:
redis-data:
networks:
backend-network:
driver: bridge