Spaces:
Sleeping
Sleeping
File size: 1,207 Bytes
d27b187 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # AgroSense on Hugging Face Spaces (Docker SDK).
# Serves the FastAPI backend + the single-page web app at the Space root.
FROM python:3.12-slim
# Non-root runtime user (HF Spaces convention: uid 1000).
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
AGROSENSE_EMBEDDING_BACKEND=hashing
WORKDIR /app
# Lean runtime deps: the FastAPI app + on-the-fly Word/PDF generation (land-record
# guides) + keyless online translation. Heavy optionals (streamlit, torch,
# sentence-transformers, faiss, tensorflow, earthengine) are intentionally excluded —
# the app degrades gracefully to its built-in fallbacks without them.
RUN pip install --no-cache-dir \
"fastapi>=0.110" "uvicorn[standard]>=0.27" "pydantic>=2.5" \
"numpy>=1.24" "requests>=2.31" "python-multipart>=0.0.9" \
"pillow>=10.0" "python-docx>=1.1" "fpdf2>=2.7" "deep-translator>=1.11"
# App code, owned by the runtime user so the runtime JSON stores (clubs, listings,
# doctor registry, loan enquiries) are writable.
COPY --chown=user:user . /app
USER user
EXPOSE 7860
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"]
|