flexigo-support-bot / Dockerfile
victor34593993's picture
deploy flexigo support bot
187966e verified
Raw
History Blame Contribute Delete
870 Bytes
# Docker image for Hugging Face Spaces (Docker SDK) — free, no card, 16GB RAM.
# Listens on 7860 (HF default). DB is external (Neon Postgres) via DATABASE_URL.
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
UV_LINK_MODE=copy \
HF_HOME=/app/.cache/hf \
PORT=7860
# HF Spaces run containers as UID 1000.
RUN useradd -m -u 1000 user
RUN pip install --no-cache-dir uv
WORKDIR /app
COPY --chown=user:user pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev && chown -R user:user /app
COPY --chown=user:user . .
RUN chown -R user:user /app
USER user
# Pre-download the embedding model into the image so cold starts are fast.
RUN uv run python -c "from app.embeddings import _get_model; _get_model()"
EXPOSE 7860
CMD ["sh", "-c", "uv run alembic upgrade head && uv run uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}"]