You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.0 KiB

services:
db:
image: postgres:16-alpine
container_name: divar_postgres
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB:-divar_crawler}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-divar_crawler}"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: divar_redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: divar_backend
command: python backend/manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
environment:
- REDIS_URL=redis://redis:6379/0
- POSTGRES_HOST=db
env_file:
- .env
volumes:
- ./backend:/app/backend
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
celery:
build:
context: .
dockerfile: Dockerfile.backend
container_name: divar_celery
command: celery -A config worker --loglevel=info -P gevent -c 20
environment:
- REDIS_URL=redis://redis:6379/0
- POSTGRES_HOST=db
env_file:
- .env
volumes:
- ./backend:/app/backend
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: divar_frontend
ports:
- "5173:5173"
environment:
- VITE_BACKEND_URL=http://backend:8000
volumes:
- ./frontend:/app/frontend
- /app/frontend/node_modules
depends_on:
- backend
volumes:
postgres_data: