-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (62 loc) · 2.68 KB
/
Copy pathDockerfile
File metadata and controls
77 lines (62 loc) · 2.68 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
72
73
74
75
76
77
# syntax=docker/dockerfile:1.7
FROM python:3.12-slim-bookworm AS builder
ARG RUST_VERSION=1.96.0
ARG TORCH_VERSION=2.9.1
ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu
ARG PYTHON_TRAINING_DEPS="datasets huggingface-hub tqdm transformers"
ENV CARGO_HOME=/usr/local/cargo \
RUSTUP_HOME=/usr/local/rustup \
PATH=/usr/local/cargo/bin:$PATH \
LIBTORCH_USE_PYTORCH=1
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
build-essential \
clang \
cmake \
git \
libssl-dev \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir torch==${TORCH_VERSION} --index-url ${TORCH_INDEX_URL} \
&& pip install --no-cache-dir ${PYTHON_TRAINING_DEPS}
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal --default-toolchain ${RUST_VERSION}
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/app/target \
export LD_LIBRARY_PATH="$(python3 -c "import os, torch; print(os.path.join(os.path.dirname(torch.__file__), 'lib'))"):${LD_LIBRARY_PATH}" \
&& cargo build --release -p aether-centralized-server \
&& cp target/release/aether-centralized-server /usr/local/bin/aether-centralized-server
FROM python:3.12-slim-bookworm AS runtime
ARG TORCH_VERSION=2.9.1
ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu
ARG PYTHON_TRAINING_DEPS="datasets huggingface-hub tqdm transformers"
ENV LIBTORCH_USE_PYTORCH=1 \
PYTHONUNBUFFERED=1 \
RUST_LOG=info \
TRAINING_RUN_CONFIG=config/training-run.toml \
CONTROL_HOST=0.0.0.0 \
CONTROL_PORT=8080 \
CONTROL_PASSWORD_FILE=/app/.aether-control/control-password \
SERVER_PORT=39405 \
WEB_PORT=8081 \
DATA_SERVER_ADDR=
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir torch==${TORCH_VERSION} --index-url ${TORCH_INDEX_URL} \
&& pip install --no-cache-dir ${PYTHON_TRAINING_DEPS}
WORKDIR /app
COPY --from=builder /usr/local/bin/aether-centralized-server /usr/local/bin/aether-centralized-server
COPY config ./config
COPY scripts ./scripts
VOLUME ["/app/data", "/app/.aether-control"]
EXPOSE 39405 39406 8080 8081
CMD ["/bin/sh", "-c", "export LD_LIBRARY_PATH=$(python3 -c \"import os, torch; print(os.path.join(os.path.dirname(torch.__file__), 'lib'))\"):${LD_LIBRARY_PATH}; exec /bin/sh scripts/docker-entrypoint.sh"]