1. Dockerfile: remove UTF-16 encoding conversion (requirements.txt now plain UTF-8) Add --forwarded-allow-ips=* to uvicorn so rate limiter + audit logs see real client IPs through nginx, not nginx container IP 2. .dockerignore: exclude pandoc MSI (~200MB), blog_images/, frontend-legacy/, *.md docs, *.docx, *.msi, *.patch, openrouter_error.log — significant image size reduction 3. requirements.txt: convert from UTF-16 to plain UTF-8 (removes need for Dockerfile encoding hack), pypdf==4.3.1 already added in previous commit 4. DEPLOYMENT.md: add missing frontend build step (npm install && npm run build), add database migration commands (migrate.py + v003 + v004 SQL files), add super admin creation step, add HTTPS setup, add backup command, add troubleshooting table 5. All secrets now come from .env only (no fallback defaults in docker-compose)
37 lines
1.0 KiB
Docker
37 lines
1.0 KiB
Docker
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# System deps: Tesseract OCR (Stage 2 of extraction pipeline — CPU-only, no GPU)
|
|
# eng: English, hin: Hindi — for bilingual Indian documents (Aadhaar, PAN, etc.)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
tesseract-ocr \
|
|
tesseract-ocr-eng \
|
|
tesseract-ocr-hin \
|
|
libgl1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies (plain UTF-8 requirements.txt)
|
|
COPY services/api/requirements.txt /tmp/requirements.txt
|
|
RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt
|
|
|
|
# Copy app source
|
|
COPY . /app
|
|
|
|
WORKDIR /app/services/api
|
|
|
|
EXPOSE 8000
|
|
|
|
# --forwarded-allow-ips=* trusts X-Forwarded-For from nginx container
|
|
# Required so rate limiter and audit logs see real client IPs (not nginx's internal IP)
|
|
CMD ["uvicorn", "app.main:app", \
|
|
"--host", "0.0.0.0", \
|
|
"--port", "8000", \
|
|
"--workers", "4", \
|
|
"--proxy-headers", \
|
|
"--forwarded-allow-ips=*"]
|