File size: 1,069 Bytes
cd4f800
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

# Create user with UID 1000 for Hugging Face Spaces non-root security
RUN useradd -m -u 1000 user
WORKDIR /app

# Install system dependencies (OpenMP libgomp1 for PyTorch / RDKit)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    curl \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy application code, configs, raw data, and checkpoints
COPY configs/ ./configs/
COPY data/raw/ ./data/raw/
COPY results/checkpoints/ ./results/checkpoints/
COPY src/ ./src/
COPY app/ ./app/
COPY frontend/dist/ ./frontend/dist/

RUN chown -R user:user /app
USER user

ENV PORT=8000 \
    LOW_MEMORY_MODE=1 \
    PYTHONUNBUFFERED=1

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
  CMD curl -f http://localhost:8000/api/health || exit 1

CMD ["sh", "-c", "uvicorn app.server:app --host 0.0.0.0 --port ${PORT:-8000}"]