Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
e47e9d10
Unverified
Commit
e47e9d10
authored
Apr 15, 2025
by
hhzhang16
Committed by
GitHub
Apr 15, 2025
Browse files
feat: base Dynamo docker image improvements and fixes (#658)
parent
da482c2f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
32 deletions
+70
-32
Earthfile
Earthfile
+70
-32
No files found.
Earthfile
View file @
e47e9d10
...
...
@@ -72,6 +72,22 @@ rust-base:
libclang-dev \
git
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \
apt install -y ./cuda-keyring_1.1-1_all.deb && \
apt update && \
apt install -y cuda-toolkit nvidia-utils-535 nvidia-driver-535 && \
rm cuda-keyring_1.1-1_all.deb
# Set CUDA compute capability explicitly
ENV CUDA_COMPUTE_CAP=80
ENV CUDA_HOME=/usr/local/cuda
ENV CUDA_ROOT=/usr/local/cuda
ENV CUDA_PATH=/usr/local/cuda
ENV CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
ENV PATH=$CUDA_HOME/bin:$PATH
ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH
...
...
@@ -85,51 +101,73 @@ rust-base:
rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
dynamo-build
er
:
dynamo-build:
FROM +rust-base
WORKDIR /workspace
COPY . /workspace/
COPY Cargo.toml Cargo.lock ./
COPY pyproject.toml README.md hatch_build.py ./
COPY components/ components/
COPY lib/ lib/
COPY launch/ launch/
COPY deploy/ deploy/
ENV CARGO_TARGET_DIR=/workspace/target
RUN cargo build --release --locked --features llamacpp,python,cuda && \
cargo doc --no-deps
# Create symlinks for wheel building
RUN mkdir -p /workspace/deploy/dynamo/sdk/src/dynamo/sdk/cli/bin/ && \
# Remove existing symlinks
rm -f /workspace/deploy/dynamo/sdk/src/dynamo/sdk/cli/bin/* && \
# Create new symlinks pointing to the correct location
ln -sf /workspace/target/release/dynamo-run /workspace/deploy/dynamo/sdk/src/dynamo/sdk/cli/bin/dynamo-run && \
ln -sf /workspace/target/release/http /workspace/deploy/dynamo/sdk/src/dynamo/sdk/cli/bin/http && \
ln -sf /workspace/target/release/llmctl /workspace/deploy/dynamo/sdk/src/dynamo/sdk/cli/bin/llmctl
RUN cargo build --release --locked --features mistralrs,sglang,vllm,python && \
strip target/release/dynamo-run && \
strip target/release/http && \
strip target/release/llmctl && \
strip target/release/metrics && \
strip target/release/mock_worker
SAVE ARTIFACT target/release/dynamo-run /dynamo-run
SAVE ARTIFACT target/release/http /http
SAVE ARTIFACT target/release/llmctl /llmctl
SAVE ARTIFACT target/release/metrics /metrics
SAVE ARTIFACT target/release/mock_worker /mock_worker
RUN cd /workspace/lib/bindings/python && \
uv build --wheel --out-dir /workspace/dist --python 3.12
RUN cd /workspace && \
uv build --wheel --out-dir /workspace/dist
# Save wheels
SAVE ARTIFACT /workspace/dist/ai_dynamo_runtime*.whl
SAVE ARTIFACT /workspace/dist/ai_dynamo*.whl
dynamo-base-docker:
ARG IMAGE=dynamo-base-docker
ARG CI_REGISTRY_IMAGE=my-registry
ARG CI_COMMIT_SHA=latest
FROM +dynamo-base
FROM ubuntu:24.04
WORKDIR /workspace
COPY . /workspace/
# Copy built binaries from builder target
COPY +dynamo-builder/dynamo-run /usr/local/bin/dynamo-run
COPY +dynamo-builder/http /usr/local/bin/http
COPY +dynamo-builder/llmctl /usr/local/bin/llmctl
COPY +dynamo-builder/metrics /usr/local/bin/metrics
COPY +dynamo-builder/mock_worker /usr/local/bin/mock_worker
COPY +dynamo-builder/dynamo-run /workspace/target/release/dynamo-run
COPY +dynamo-builder/http /workspace/target/release/http
COPY +dynamo-builder/llmctl /workspace/target/release/llmctl
COPY +dynamo-builder/metrics /workspace/target/release/metrics
COPY +dynamo-builder/mock_worker /workspace/target/release/mock_worker
RUN uv build --wheel --out-dir /workspace/dist && \
uv pip install /workspace/dist/ai_dynamo*any.whl
SAVE IMAGE --push $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA
# Install Python and other dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3.12 \
curl && \
rm -rf /var/lib/apt/lists/*
COPY +uv-source/uv /bin/uv
# Create and activate virtual environment
RUN mkdir -p /opt/dynamo && \
uv venv /opt/dynamo/venv --python 3.12 && \
. /opt/dynamo/venv/bin/activate && \
uv pip install pip
ENV VIRTUAL_ENV=/opt/dynamo/venv
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Copy and install wheels -- ai-dynamo-runtime first, then ai-dynamo
COPY +dynamo-build/ai_dynamo_runtime*.whl /tmp/wheels/
COPY +dynamo-build/ai_dynamo*.whl /tmp/wheels/
RUN . /opt/dynamo/venv/bin/activate && \
uv pip install /tmp/wheels/*.whl && \
rm -rf /tmp/wheels
SAVE IMAGE --push $CI_REGISTRY_IMAGE/$IMAGE:$CI_COMMIT_SHA
############### ALL TARGETS ##############################
all-test:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment