Added static and media file serving and Silk profiling in Django URLs. Updated docker-compose to mount backend/frontend code, adjust commands, and switch to 'trznice' app references. Enhanced Tailwind config to extend default colors and import defaultTheme.
124 lines
2.6 KiB
YAML
124 lines
2.6 KiB
YAML
services:
|
|
backend:
|
|
container_name: backend-vontor-cz
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
restart: always
|
|
env_file:
|
|
- ./backend/.env
|
|
networks:
|
|
- app_network
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
volumes:
|
|
- ./backend:/app
|
|
- static-data:/app/collectedstaticfiles
|
|
- media-data:/app/media
|
|
command: sh -c "
|
|
python manage.py migrate --noinput &&
|
|
python manage.py collectstatic --clear --noinput &&
|
|
python manage.py seed_app_config &&
|
|
gunicorn -k uvicorn.workers.UvicornWorker trznice.asgi:application --bind 0.0.0.0:8000"
|
|
ports:
|
|
- "8000:8000"
|
|
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: postgres-vontor-cz
|
|
restart: always
|
|
env_file:
|
|
- ./backend/.env
|
|
volumes:
|
|
- db-data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- app_network
|
|
|
|
|
|
redis: #extremly fast db, stores data in RAM memory
|
|
container_name: redis-vontor-cz
|
|
image: redis:alpine
|
|
restart: always
|
|
env_file:
|
|
- ./backend/.env
|
|
volumes:
|
|
- redis-data:/data
|
|
expose:
|
|
- "6379"
|
|
networks:
|
|
- app_network
|
|
|
|
celery: #task queue for handling asynchronous/hard tasks
|
|
container_name: celery-vontor-cz
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
command: celery -A trznice worker --loglevel=info
|
|
restart: always
|
|
env_file:
|
|
- ./backend/.env
|
|
volumes:
|
|
- ./backend:/app
|
|
depends_on:
|
|
- redis
|
|
- db
|
|
- backend
|
|
networks:
|
|
- app_network
|
|
|
|
celery-beat: #periodic tasks scheduler
|
|
container_name: celery-beat-vontor-cz
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
command: celery -A trznice beat --loglevel=info
|
|
restart: always
|
|
env_file:
|
|
- ./backend/.env
|
|
volumes:
|
|
- ./backend:/app
|
|
depends_on:
|
|
- redis
|
|
- db
|
|
- backend
|
|
networks:
|
|
- app_network
|
|
|
|
#end of backend services -----------------------
|
|
|
|
nginx: #web server, reverse proxy, serves static files
|
|
container_name: nginx-vontor-cz
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile.prod
|
|
env_file:
|
|
- ./frontend/.env
|
|
ports:
|
|
- 80:80
|
|
# - 9000:80
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- app_network
|
|
volumes:
|
|
- ./frontend/dist:/usr/share/nginx/html
|
|
- static-data:/app/collectedstaticfiles # static (Django)
|
|
- media-data:/app/media # media (Django)
|
|
- ./frontend/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
|
|
|
|
|
|
networks:
|
|
app_network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
redis-data:
|
|
db-data:
|
|
static-data:
|
|
media-data:
|
|
|