dressed_for_succes_store/docker-compose.yml

136 lines
3.1 KiB
YAML

version: '3.8'
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: dressed-for-success-backend
hostname: backend
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/shop_db
- DEBUG=0
- SECRET_KEY=supersecretkey
- UPLOAD_DIRECTORY=/app/uploads
- MEILISEARCH_URL=http://meilisearch:7700
- MEILISEARCH_KEY=dNmMmxymWpqTFyWSSFyg3xaGlEY6Pn7Ld-dyrnKRMzM
depends_on:
postgres:
condition: service_healthy
meilisearch:
condition: service_healthy
volumes:
- ./backend/uploads:/app/uploads
networks:
app_network:
aliases:
- backend
dns_search: .
restart: always
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8000/" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: dressed-for-success-frontend
hostname: frontend
expose:
- "3000"
environment:
- NEXT_PUBLIC_API_URL=http://0.0.0.0:8000/api
- NEXT_PUBLIC_BASE_URL=http://0.0.0.0:8000
- NODE_ENV=production
depends_on:
backend:
condition: service_healthy
networks:
app_network:
aliases:
- frontend
dns_search: .
restart: always
nginx:
image: nginx:alpine
container_name: dressed-for-success-nginx
ports:
- "80:80"
# - "443:443" # Раскомментируйте для HTTPS
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./backend/uploads:/app/uploads:ro
depends_on:
- frontend
- backend
networks:
- app_network
restart: always
postgres:
image: postgres:15
container_name: dressed-for-success-db
hostname: postgres
environment:
POSTGRES_DB: shop_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5434:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
app_network:
aliases:
- postgres
dns_search: .
restart: always
meilisearch:
image: getmeili/meilisearch:latest
container_name: dressed-for-success-meilisearch
hostname: meilisearch
ports:
- "7700:7700"
environment:
- MEILI_MASTER_KEY=dNmMmxymWpqTFyWSSFyg3xaGlEY6Pn7Ld-dyrnKRMzM
- MEILI_NO_ANALYTICS=true
- MEILI_ENV=production
volumes:
- meilisearch_data:/meili_data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
networks:
app_network:
aliases:
- meilisearch
dns_search: .
restart: always
networks:
app_network:
driver: bridge
volumes:
postgres_data:
driver: local
backend_uploads:
driver: local
meilisearch_data:
driver: local