111 lines
2.7 KiB
YAML
111 lines
2.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: pg-admin-db
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
POSTGRES_DB: ${DB_NAME:-pg_admin}
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./docker/init-db.sql:/docker-entrypoint-initdb.d/init.sql
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-pg_admin}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- pg-admin-network
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: ../docker/Dockerfile.backend
|
|
container_name: pg-admin-api
|
|
environment:
|
|
NODE_ENV: ${NODE_ENV:-production}
|
|
PORT: ${API_PORT:-3000}
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
DB_NAME: ${DB_NAME:-pg_admin}
|
|
JWT_SECRET: ${JWT_SECRET:-change_me_in_production}
|
|
JWT_EXPIRE: ${JWT_EXPIRE:-7d}
|
|
MAX_CONNECTIONS: ${MAX_CONNECTIONS:-20}
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
ports:
|
|
- "${API_PORT:-3000}:${API_PORT:-3000}"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./backend/src:/app/src
|
|
- ./backend/logs:/app/logs
|
|
networks:
|
|
- pg-admin-network
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: ../docker/Dockerfile.frontend
|
|
container_name: pg-admin-ui
|
|
environment:
|
|
REACT_APP_API_URL: ${FRONTEND_API_URL:-http://localhost:3000/api}
|
|
REACT_APP_ENV: ${NODE_ENV:-production}
|
|
ports:
|
|
- "${FRONTEND_PORT:-80}:3000"
|
|
depends_on:
|
|
- backend
|
|
volumes:
|
|
- ./frontend/src:/app/src
|
|
networks:
|
|
- pg-admin-network
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: pg-admin-cache
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
environment:
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD:-change_me}
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- pg-admin-network
|
|
restart: unless-stopped
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: pg-admin-proxy
|
|
ports:
|
|
- "${NGINX_PORT:-8080}:80"
|
|
volumes:
|
|
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- pg-admin-network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
pg-admin-network:
|
|
driver: bridge
|