- Simplified the .env.example file by removing outdated comments and consolidating environment variable descriptions. - Updated the architecture documentation to reflect the new structure and components of the .NET 10 microservice template. - Enhanced clarity in the README.md to provide a more comprehensive overview of the template's features and requirements. - Removed obsolete appsettings files to streamline the project structure and improve usability.
73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
version: '3.8'
|
|
|
|
# EN: Docker Compose for local development
|
|
# VI: Docker Compose cho phát triển local
|
|
|
|
services:
|
|
myservice-api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: myservice-api
|
|
ports:
|
|
- "5000:8080"
|
|
environment:
|
|
- ASPNETCORE_ENVIRONMENT=Development
|
|
- DATABASE_URL=Host=postgres;Port=5432;Database=myservice_db;Username=postgres;Password=postgres
|
|
- REDIS_URL=redis:6379
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- myservice-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: myservice-postgres
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: myservice_db
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- myservice-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: myservice-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- myservice-network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
myservice-network:
|
|
driver: bridge
|