-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (42 loc) · 2.13 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (42 loc) · 2.13 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
# syntax=docker/dockerfile:1
# ---------------------------------------------------------------------------
# Base image for the `jupyter` and `api` services.
#
# We start from a slim Python 3.11 image and install a CUDA 12.8 build of
# PyTorch from the dedicated `cu128` wheel index. Those wheels bundle the CUDA
# runtime libraries, so the only host requirement is a recent NVIDIA driver plus
# the NVIDIA Container Toolkit. This is what makes the RTX 5070 Ti (Blackwell,
# compute capability sm_120) usable inside the container.
# ---------------------------------------------------------------------------
FROM python:3.11-slim-bookworm
# Avoid interactive prompts and keep Python output unbuffered for clean logs.
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
# Cache HuggingFace models under /app/.cache so a mounted volume can persist them.
HF_HOME=/app/.cache/huggingface
WORKDIR /app
# Minimal system packages: curl is used by container healthchecks.
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
# 1) Install GPU-enabled PyTorch FIRST so later packages (sentence-transformers)
# see torch already satisfied and do not pull a CPU-only build.
RUN pip install torch --index-url https://download.pytorch.org/whl/cu128
# 2) Install project + dev dependencies (mirrors pyproject.toml).
COPY requirements.txt requirements-dev.txt ./
RUN pip install -r requirements-dev.txt
# 3) JupyterLab for the notebook service.
RUN pip install jupyterlab
# 4) Install the project package in editable mode. Source is mounted at runtime,
# so editable keeps notebook/code changes live without rebuilding the image.
COPY pyproject.toml README.md ./
COPY src ./src
RUN pip install -e .
# Copy the rest of the project (notebooks, tests, etc.).
COPY . .
# api: 8000 (FastAPI/uvicorn), jupyter: 8888 (JupyterLab)
EXPOSE 8000 8888
# Default command is overridden per service in docker-compose.yml.
CMD ["python", "-c", "print('Override CMD via docker-compose service definition.')"]