Dockerfile.none 1.87 KB
Newer Older
1
2
FROM ubuntu:24.04 AS dev

3
# libclang-dev && git needed for llamacpp engine deps in dynamo-run build
4
RUN apt-get update && \
5
    DEBIAN_FRONTEND=noninteractive apt-get install -yq python3-dev python3-pip python3-venv libucx0 libclang-dev git
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN mkdir /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}"

# Rust build/dev dependencies
RUN apt update -y && \
    apt install --no-install-recommends -y \
    wget \
    build-essential \
    protobuf-compiler \
    cmake \
    libssl-dev \
    pkg-config

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH \
29
    RUST_VERSION=1.86.0 \
30
31
32
33
34
35
36
37
38
39
40
    RUSTARCH=x86_64-unknown-linux-gnu

RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
    echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \
    chmod +x rustup-init && \
    ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${RUSTARCH} && \
    rm rustup-init && \
    chmod -R a+w $RUSTUP_HOME $CARGO_HOME


WORKDIR /workspace
41
ENV DYNAMO_HOME=/workspace
42
43
44
45
46
47
48

COPY . /workspace/

ARG CARGO_BUILD_JOBS

ENV CARGO_TARGET_DIR=/workspace/target

49
RUN cargo build --release --locked --features mistralrs,python && \
50
51
52
53
54
55
56
57
58
59
60
    cargo doc --no-deps && \
    cp target/release/dynamo-run /usr/local/bin && \
    cp target/release/http /usr/local/bin && \
    cp target/release/llmctl /usr/local/bin && \
    cp target/release/metrics /usr/local/bin && \
    cp target/release/mock_worker /usr/local/bin


RUN uv build --wheel --out-dir /workspace/dist && \
    uv pip install /workspace/dist/ai_dynamo*any.whl