Siddh12334's picture
feat: optimize Space β€” dockerignore, dotenv secrets, multi-worker uvicorn
0eb0abc
Raw
History Blame
650 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install deps first (cached layer β€” only invalidated when requirements change)
COPY requirements-server.txt .
RUN pip install --no-cache-dir -r requirements-server.txt
# Copy source (excludes venv/, training/, assets/, .git/ via .dockerignore)
COPY . .
# Pre-generate facts.json at build time; falls back gracefully if network is down
RUN python -m data.loader || echo "facts.json generation skipped β€” will use fallback facts"
EXPOSE 7860
# 2 workers: handles concurrent sessions without threading issues
CMD ["uvicorn", "environment.server:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]