build(deployment): use sibling repos as docker build context

This commit is contained in:
2026-04-23 19:50:44 +03:30
parent ed47645fef
commit 3b052aeca4
7 changed files with 81 additions and 46 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,3 @@
.env
backend/qlockify-backend/
frontend/qlockify-frontend/
backend/logs/
backend/.pytest_cache/

33
README.md Normal file
View File

@@ -0,0 +1,33 @@
# Qlockify Deployment
This repository is the deployment layer only.
It does not contain application source copies. Docker builds read directly from the sibling repositories:
- `../qlockify-backend`
- `../qlockify-frontend`
## Local structure
The expected directory layout is:
```text
Qlockify/
qlockify-backend/
qlockify-frontend/
qlockify-deployment/
```
## Deployment flow
1. Configure deployment env files:
- `./.env`
- `./backend/.env`
- `./frontend/.env`
2. From `qlockify-deployment`, build and start the stack:
```powershell
docker compose up --build
```
The backend container runs database migrations and `collectstatic` on startup, then serves Django with Gunicorn using `config.wsgi:application`.

View File

@@ -11,7 +11,7 @@ DJANGO_ALLOWED_HOSTS=
POSTGRES_DB=app_db
POSTGRES_USER=app_user
POSTGRES_PASSWORD=app_password
POSTGRES_HOST=localhost
POSTGRES_HOST=db
POSTGRES_PORT=5432
# CORS / CSRF
@@ -30,11 +30,11 @@ JWT_ALGORITHM=HS256
# Redis / Celery
REDIS_URL=redis://redis:6379/0
REDIS_HOST=127.0.0.1
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
CELERY_BROKER_URL=
CELERY_RESULT_BACKEND=
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
# Timzone / Language
LANGUAGE_CODE=en-us

View File

@@ -22,4 +22,4 @@ RUN pip install --no-cache-dir -r requirements/base.txt \
COPY qlockify-backend/ .
CMD ["gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000"]
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000"]

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
db:
image: postgres:18-alpine
@@ -28,14 +26,18 @@ services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
context: ..
dockerfile: qlockify-deployment/backend/Dockerfile
restart: always
env_file:
- ./backend/.env
volumes:
- static_data:/app/staticfiles
- media_data:/app/mediafiles
command: >
sh -c "python manage.py migrate &&
python manage.py collectstatic --noinput &&
gunicorn config.wsgi:application --bind 0.0.0.0:8000"
expose:
- "8000"
depends_on:
@@ -46,14 +48,14 @@ services:
celery:
build:
context: ./backend
dockerfile: Dockerfile
context: ..
dockerfile: qlockify-deployment/backend/Dockerfile
restart: always
env_file:
- ./backend/.env
volumes:
- media_data:/app/mediafiles
command: celery -A core worker -l INFO
command: celery -A config worker -l INFO
depends_on:
db:
condition: service_healthy
@@ -64,8 +66,8 @@ services:
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
context: ..
dockerfile: qlockify-deployment/frontend/Dockerfile
restart: always
env_file:
- ./frontend/.env