Files
site_backend/docker-compose.yml
Shayan Azadi 50c9cf613f Add admin login API and remove hardcoded secrets
- Add token-based admin login/logout/me endpoints
- Bootstrap admin from ADMIN_USERNAME/ADMIN_PASSWORD in Docker entrypoint
- Read ALLOWED_HOSTS and CORS from env only (no hardcoded server IPs)
- Keep docs/Postman/tests free of real credentials
- Cover login and auth flows with 31 local API tests

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 17:29:47 +03:30

63 lines
1.6 KiB
YAML

version: '3.8'
services:
db:
image: postgres:15-alpine
container_name: zonco_db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-Zoneco_ORG}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- zonco_network
web:
build:
context: .
dockerfile: Dockerfile
container_name: zonco_backend
restart: unless-stopped
command: gunicorn zonco_backend.wsgi:application --bind 0.0.0.0:8000 --workers 3 --timeout 120
volumes:
- ./media:/app/media
- ./staticfiles:/app/staticfiles
ports:
- "${DJANGO_PORT:-8000}:8000"
env_file:
- .env
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-Zoneco_ORG}
- POSTGRES_HOST=db
- ADMIN_USERNAME=${ADMIN_USERNAME:-}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-}
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- zonco_network
volumes:
postgres_data:
driver: local
networks:
zonco_network:
driver: bridge