Shopvite-Fastapi / Dockerfile
MISSAOUI's picture
Update Dockerfile
9b5a46a verified
# ── Base image ────────────────────────────────────────────────────────────────
FROM python:3.11-slim
# HuggingFace Spaces runs as a non-root user (UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR $HOME/app
# ── Install dependencies ───────────────────────────────────────────────────────
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# ── Copy application files ────────────────────────────────────────────────────
# Make sure faiss_index/, prompt_engineering.py, and main.py are all present
COPY --chown=user . .
# ── Expose port 7860 (required by HuggingFace Spaces) ────────────────────────
EXPOSE 7860
# ── Launch ────────────────────────────────────────────────────────────────────
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]