Spaces:
Sleeping
Sleeping
File size: 893 Bytes
0f204c8 | 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 | FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
MODEL_DIR=/model
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
libxrender-dev \
libsm6 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu && \
pip install torch-geometric && \
pip install rdkit && \
pip install -r requirements.txt
RUN mkdir -p /model
COPY . .
RUN useradd -m -u 1000 user && \
chown -R user:user /app /model
USER user
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD curl -f http://localhost:7860/api/health || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|