AnGrapicStudio/brain-x-stage2-simulation
0
1FROM python:3.11-slim
2
3WORKDIR /app
4
5# Install system dependencies
6RUN apt-get update && apt-get install -y \
7 g++ \
8 build-essential \
9 libffi-dev \
10 python3-dev \
11 libgomp1 \
12 curl \
13 && rm -rf /var/lib/apt/lists/*
14
15# Copy strictly necessary files
16COPY requirements.txt .
17RUN pip install --no-cache-dir -r requirements.txt
18
19# Compile native core
20COPY nuclear_kernel.cpp .
21RUN g++ -O3 -shared -fPIC nuclear_kernel.cpp -o libvgpu.so
22
23# NOTE: We copy app_stage2.py AS app.py in deployment script
24COPY app.py .
25
26# Set environment
27ENV VGPU_LIB_PATH=/app/libvgpu.so
28ENV PYTHONPATH=/app
29ENV PORT=7860
30
31# Expose port
32EXPOSE 7860
33
34# Health check
35HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
36 CMD curl -f http://localhost:7860/health || exit 1
37
38# Run
39CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
40 