node-api-template/docker-compose.development.yml

73 lines
1.3 KiB
YAML
Raw Normal View History

2024-07-03 18:52:30 +00:00
services:
redis:
2024-07-05 19:34:48 +00:00
container_name: node_api_redis
2024-07-03 18:52:30 +00:00
image: redis:6.2.14-alpine
healthcheck:
2024-07-05 19:34:48 +00:00
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
2024-07-03 18:52:30 +00:00
ports:
- 6379:6379
expose:
- 6379
restart: always
networks:
2024-07-05 19:34:48 +00:00
- node_api_network
2024-07-03 18:52:30 +00:00
server:
2024-07-05 19:34:48 +00:00
container_name: node_api_server
build:
context: .
dockerfile: Dockerfile.development
2024-07-03 18:52:30 +00:00
volumes:
- .:/app
ports:
- 3000:3000
expose:
- 3000
restart: always
networks:
2024-07-05 19:34:48 +00:00
- node_api_network
environment:
- REDIS_HOST=redis
2024-07-03 18:52:30 +00:00
links:
- database
- redis
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
database:
2024-07-05 19:34:48 +00:00
container_name: node_api_database
image: postgres:16.3
user: postgres
2024-07-03 18:52:30 +00:00
healthcheck:
2024-07-05 19:34:48 +00:00
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
2024-07-03 18:52:30 +00:00
cap_add:
- SYS_NICE
ports:
2024-07-05 19:34:48 +00:00
- 5432:5432
2024-07-03 18:52:30 +00:00
expose:
2024-07-05 19:34:48 +00:00
- 5432
2024-07-03 18:52:30 +00:00
volumes:
2024-07-05 19:34:48 +00:00
- db:/var/lib/postgresql/data
2024-07-03 18:52:30 +00:00
restart: always
networks:
2024-07-05 19:34:48 +00:00
- node_api_network
2024-07-03 18:52:30 +00:00
environment:
2024-07-05 19:34:48 +00:00
- POSTGRES_PASSWORD=myPassword
2024-07-03 18:52:30 +00:00
networks:
2024-07-05 19:34:48 +00:00
node_api_network:
2024-07-03 18:52:30 +00:00
driver: bridge
volumes:
db:
driver: local