File size: 1,306 Bytes
a4cfbff
 
 
a2875a2
 
9377cd8
a4cfbff
9377cd8
 
a4cfbff
9377cd8
 
 
a4cfbff
 
9377cd8
d129e37
 
 
a4cfbff
9377cd8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# GPU-enabled Dockerfile for DGX Spark deployment (ARM64/aarch64 + GB10)
# Using NVIDIA NGC PyTorch container - optimized for latest NVIDIA hardware
# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch
# Using 24.08 for Python 3.10 compatibility with older package versions
FROM nvcr.io/nvidia/pytorch:24.08-py3

# Install additional system dependencies
RUN apt-get update && apt-get install -y \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# PyTorch is pre-installed in NGC container with proper GPU support
# Just install remaining requirements (excluding torch, zarr, numcodecs)
COPY requirements.txt .
RUN grep -v "^torch==" requirements.txt | \
    grep -v "^zarr==" | \
    grep -v "^numcodecs==" > requirements-spark.txt && \
    pip install --no-cache-dir -r requirements-spark.txt

# Copy backend code
COPY backend/ ./backend/
COPY app.py .

# Create runs directory
RUN mkdir -p /app/runs

# Health check (uses configurable port via environment)
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:${PORT:-8000}/health || exit 1

# Expose configurable port
EXPOSE ${PORT:-8000}

# Default command (overridden by compose.spark.yml)
CMD ["uvicorn", "backend.model_service:app", "--host", "0.0.0.0", "--port", "8000"]