Spaces:
Paused
Paused
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Create user with UID 1000 for Hugging Face Spaces non-root security
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies (OpenMP libgomp1 for PyTorch / RDKit)
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
build-essential \
|
| 10 |
+
curl \
|
| 11 |
+
libgomp1 \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# Install Python dependencies
|
| 15 |
+
COPY requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 17 |
+
pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Copy application code, configs, raw data, and checkpoints
|
| 20 |
+
COPY configs/ ./configs/
|
| 21 |
+
COPY data/raw/ ./data/raw/
|
| 22 |
+
COPY results/checkpoints/ ./results/checkpoints/
|
| 23 |
+
COPY src/ ./src/
|
| 24 |
+
COPY app/ ./app/
|
| 25 |
+
COPY frontend/dist/ ./frontend/dist/
|
| 26 |
+
|
| 27 |
+
RUN chown -R user:user /app
|
| 28 |
+
USER user
|
| 29 |
+
|
| 30 |
+
ENV PORT=8000 \
|
| 31 |
+
LOW_MEMORY_MODE=1 \
|
| 32 |
+
PYTHONUNBUFFERED=1
|
| 33 |
+
|
| 34 |
+
EXPOSE 8000
|
| 35 |
+
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
| 37 |
+
CMD curl -f http://localhost:8000/api/health || exit 1
|
| 38 |
+
|
| 39 |
+
CMD ["sh", "-c", "uvicorn app.server:app --host 0.0.0.0 --port ${PORT:-8000}"]
|