64 lines
1.3 KiB
YAML
64 lines
1.3 KiB
YAML
services:
|
|
# PostgreSQL database
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: egor
|
|
POSTGRES_PASSWORD: barsik
|
|
POSTGRES_DB: delivery_tracker
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U egor -d delivery_tracker"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Backend API
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
environment:
|
|
DATABASE_URL: postgres://egor:barsik@postgres:5432/delivery_tracker?sslmode=disable
|
|
ports:
|
|
- "8081:8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
# Development service with hot reload
|
|
frontend-dev:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
volumes:
|
|
- ./frontend:/app
|
|
- node_modules:/app/node_modules
|
|
ports:
|
|
- "5173:5173"
|
|
environment:
|
|
- NODE_ENV=development
|
|
command: sh -c "yarn install && yarn dev --host"
|
|
stdin_open: true
|
|
tty: true
|
|
|
|
# Production frontend service
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
ports:
|
|
- "8080:80"
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
node_modules:
|
|
postgres_data:
|