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

90 lines
1.6 KiB
YAML

services:
proxy:
container_name: node_api_proxy
image: nginx:alpine
ports:
- 80:80
- 443:443
expose:
- 80
- 443
volumes:
- ./configs/nginx.conf:/etc/nginx/nginx.conf
restart: always
networks:
- node_api_network
depends_on:
- server
links:
- server
redis:
container_name: node_api_redis
image: redis:6.2.14-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
ports:
- 6379:6379
expose:
- 6379
restart: always
networks:
- node_api_network
server:
container_name: node_api_server
build:
context: .
dockerfile: Dockerfile.production
ports:
- 3000:3000
expose:
- 3000
restart: always
networks:
- node_api_network
environment:
- REDIS_HOST=redis
links:
- database
- redis
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
database:
container_name: node_api_database
image: postgres:16.3
user: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
cap_add:
- SYS_NICE
ports:
- 5432:5432
expose:
- 5432
volumes:
- db:/var/lib/postgresql/data
restart: always
networks:
- node_api_network
environment:
- POSTGRES_PASSWORD=myPassword
networks:
node_api_network:
driver: bridge
volumes:
db:
driver: local