feat: 初始化后端微服务架构骨架
This commit is contained in:
64
backend/docker-compose.dev.yml
Normal file
64
backend/docker-compose.dev.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Nginx 网关
|
||||
nginx:
|
||||
image: nginx:1.25-alpine
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
- gateway
|
||||
|
||||
# 网关服务
|
||||
gateway:
|
||||
build:
|
||||
context: ./gateway
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- ./gateway:/app
|
||||
command: air -c .air.toml
|
||||
depends_on:
|
||||
- user-svc
|
||||
- redis
|
||||
|
||||
# 用户服务
|
||||
user-svc:
|
||||
build:
|
||||
context: ./services/user-svc
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "9000:9000"
|
||||
volumes:
|
||||
- ./services/user-svc:/app
|
||||
command: air -c .air.toml
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
# 数据库
|
||||
postgres:
|
||||
image: postgres:18.3-alpine3.23
|
||||
environment:
|
||||
POSTGRES_USER: admin
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: backend
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
- ./services/user-svc/migrations:/docker-entrypoint-initdb.d
|
||||
|
||||
# Redis
|
||||
redis:
|
||||
image: redis:8.6.2-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis-data:/var/lib/redis/data
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
Reference in New Issue
Block a user