File size: 1,533 Bytes
127ebd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# BunGPT-DeepEdu-Decision-4B-Open HTTP server (deepedu_decision.serve). Build context: the repo's source/ folder.
#   docker build -f deploy/Dockerfile -t deepedu-decision:0.1.0 .
# The image holds the code only; the model folder is mounted at /model at run time (see docker-compose.yml).
FROM python:3.12-slim

# Triton (used by flash-linear-attention) compiles a small C launcher at run time, so it needs a C compiler.
RUN apt-get update && apt-get install -y --no-install-recommends gcc libc6-dev \
    && rm -rf /var/lib/apt/lists/*

# CUDA 12.8 torch wheel: needs an NVIDIA driver >= 570 on the host.
ARG TORCH_INDEX=https://download.pytorch.org/whl/cu128
RUN pip install --no-cache-dir torch==2.10.0 --index-url ${TORCH_INDEX} \
    && pip install --no-cache-dir transformers==5.23.0 flash-linear-attention==0.5.2 safetensors huggingface_hub numpy

COPY pyproject.toml README.md LICENSE /app/
COPY src /app/src
RUN pip install --no-cache-dir --no-deps /app

RUN useradd -m -u 1000 app && mkdir -p /cache && chown app /cache
USER app
ENV HF_HUB_OFFLINE=1 \
    TRITON_CACHE_DIR=/cache/triton \
    TORCHINDUCTOR_CACHE_DIR=/cache/inductor \
    PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
    PYTHONUNBUFFERED=1

EXPOSE 9100
HEALTHCHECK --interval=30s --timeout=5s --start-period=300s --retries=3 \
    CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9100/health', timeout=4)"
ENTRYPOINT ["python", "-m", "deepedu_decision.serve", "--model", "/model", "--host", "0.0.0.0", "--port", "9100"]