meridian-api / Dockerfile
Demon1212122's picture
fix: backend features like auth added
bb47502
Raw
History Blame Contribute Delete
2.64 kB
# ─────────────────────────────────────────────────────────────────
# Meridian β€” Hugging Face Spaces Dockerfile
# Deploy: Create a new HF Space (Docker SDK), push this repo.
# Models are downloaded at first boot from your HF model repo.
# ─────────────────────────────────────────────────────────────────
FROM python:3.11-slim
# HF Spaces requires port 7860
ENV PORT=7860
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# ── Runtime secrets (set via HF Spaces Secrets UI β€” never hardcode) ──
# These are declared here so Docker knows they exist; actual values
# come from the Spaces "Secrets" tab at deploy time.
ENV OPENAI_API_KEY=""
ENV THERAPY_MODEL="gpt-4o-mini"
ENV SUPABASE_URL=""
ENV SUPABASE_ANON_KEY=""
ENV SUPABASE_SERVICE_KEY=""
ENV ALLOWED_ORIGINS="https://meridian-frontend-green.vercel.app"
ENV APP_ENV="production"
WORKDIR /app
# ── System deps ───────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl && \
rm -rf /var/lib/apt/lists/*
# ── Python deps ───────────────────────────────────────────────────
COPY requirements.txt .
# Add huggingface_hub for model download at startup
RUN pip install --no-cache-dir -r requirements.txt huggingface_hub && \
python -m spacy download en_core_web_sm
# ── Copy application code ────────────────────────────────────────
COPY backend/ backend/
COPY scripts/ scripts/
# ── Create models directory (models downloaded at runtime) ────────
RUN mkdir -p backend/models/mentalroberta_onnx
# ── Model download script ────────────────────────────────────────
COPY scripts/download_models.py scripts/download_models.py
# ── Startup script ────────────────────────────────────────────────
# Downloads models if not cached, then starts uvicorn
COPY start.sh .
RUN chmod +x start.sh
EXPOSE 7860
CMD ["./start.sh"]