-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (58 loc) · 2.42 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (58 loc) · 2.42 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Tributo Docker image — Ray 2.55.1 + Tributo (source-only)
#
# Build (BuildKit required for cache mounts):
# DOCKER_BUILDKIT=1 docker build -t tributo:latest .
#
# Build with custom base image (e.g. GPU):
# docker build --build-arg BASE_IMAGE=rayproject/ray:2.55.1-py312-gpu -t tributo:gpu .
#
# Build for specific platform:
# docker build --platform linux/amd64 -t tributo:latest .
ARG BASE_IMAGE=rayproject/ray:2.55.1-py312
ARG TORCH_VERSION=2.12.1
ARG PIP_INDEX_URL=https://pypi.org/simple
ARG TZ=UTC
FROM ${BASE_IMAGE}
ARG EXTRAS="training,identity,streaming,registry"
ARG TORCH_VERSION
ARG PIP_INDEX_URL
ARG TZ
USER root
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=${TZ}
# System dependencies (apt cache persists across builds)
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends curl wget git && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /workspace && chown ray:users /workspace
USER ray
# Pre-install CPU-only torch (pip cache persists across builds).
# TORCH_VERSION pins the reproducible default image; pyproject.toml keeps a
# loose floor (torch>=2.5.0) so GPU users can layer CUDA wheels on top.
# CUDA wheels live under a different index (whl/cuXXX), so a GPU build must
# override both TORCH_VERSION and PIP_INDEX_URL, e.g.:
# docker build --build-arg TORCH_VERSION=2.12.1+cu121 \
# --build-arg PIP_INDEX_URL=https://download.pytorch.org/whl/cu121 ...
RUN --mount=type=cache,target=/home/ray/.cache/pip \
/home/ray/anaconda3/bin/pip install \
--timeout 600 --retries 10 \
-i ${PIP_INDEX_URL} \
--extra-index-url https://download.pytorch.org/whl/cpu \
torch==${TORCH_VERSION}
# Copy only source code + build files (see .dockerignore)
COPY . /opt/tributo
# Install Tributo with all extras (pip cache persists across builds).
# Dependencies are resolved by pip from pyproject.toml; the reproducible
# default comes from the pinned BASE_IMAGE tag (Ray 2.55.1 + Python 3.12)
# and TORCH_VERSION. The repo's uv.lock gates CI reproducibility — Docker
# builds are intentionally not lock-bound.
RUN --mount=type=cache,target=/home/ray/.cache/pip \
/home/ray/anaconda3/bin/pip install \
--timeout 600 --retries 10 \
-i ${PIP_INDEX_URL} \
-e "/opt/tributo[${EXTRAS}]"
WORKDIR /workspace
USER ray
EXPOSE 8265 10001 8000 8001