diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..17c5b20 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,62 @@ +services: + backend: + build: + context: . + dockerfile: Dockerfile + container_name: dpage-api + restart: unless-stopped + env_file: + - .env + environment: + NODE_ENV: production + DB_HOST: postgres + DB_PORT: 5432 + REDIS_HOST: redis + REDIS_PORT: 6379 + APP_PORT: 4000 + DANAK_API_URL: ${DANAK_API_URL_DOCKER:-http://host.docker.internal:3500} + ports: + - "${APP_PORT:-4000}:4000" + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + extra_hosts: + - "host.docker.internal:host-gateway" + + postgres: + image: postgres:16-alpine + container_name: dpage-postgres + restart: unless-stopped + environment: + POSTGRES_DB: ${DB_NAME:-dpage} + POSTGRES_USER: ${DB_USER:-root} + POSTGRES_PASSWORD: ${DB_PASS:-postgres} + ports: + - "${DB_PORT:-5432}:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + interval: 5s + timeout: 5s + retries: 5 + + redis: + image: redis:7-alpine + container_name: dpage-redis + restart: unless-stopped + ports: + - "${REDIS_PORT:-6379}:6379" + volumes: + - redis_data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + postgres_data: + redis_data: