Spaces:
Sleeping
Sleeping
File size: 1,890 Bytes
6859bba 6908b1e 6859bba | 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 32 33 34 35 36 37 38 39 40 41 42 43 44 | # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Workflow360 AI Server β HuggingFace Spaces Dockerfile
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Free tier: 16 GB RAM, 2 vCPUs, 50 GB storage, no spin-down.
# Fits all 3 AI models (FLAN-T5, SBERT+sklearn, XGBoost) comfortably.
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.11-slim
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces runs as user id 1000 with read/write to /app
RUN useradd -m -u 1000 user
WORKDIR /app
RUN chown -R user:user /app
# Copy requirements first for layer caching
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Pre-download SBERT model to image (avoids cold start delay)
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
# Copy application code
COPY --chown=user:user . .
USER user
ENV PYTHONUNBUFFERED=1
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
ENV MODEL_DIR=/app/model_weights
ENV DEVICE=cpu
# HF Spaces expects port 7860 by default
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|