-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.cpu
56 lines (41 loc) · 1.32 KB
/
Dockerfile.cpu
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
FROM ubuntu:22.04 as sys
# Install rust dependencies
RUN apt-get update -qq \
&& apt-get install -qq -y vim gcc g++ curl git build-essential libssl-dev openssl pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Python
RUN apt-get update && \
apt-get install -y python3-pip python3-dev python3-venv && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy our manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./src ./src
COPY ./ci ./ci
FROM sys as build
WORKDIR /app
RUN python3 -m venv venv
RUN . venv/bin/activate
# Install Python scripts for model download
RUN pip install -r ci/requirements.txt
ARG TARGETARCH
ARG MODEL_NAME
ENV MODEL_NAME ${MODEL_NAME}
ENV ONNX_RUNTIME true
ENV ONNX_CPU=${TARGETARCH}
ENV MODEL_DIR "./models/model"
# Download the models
RUN python3 -m ci.download
# Build only the dependencies to cache them
RUN cargo build --release
FROM rust:1.77.1-slim-bookworm as release
COPY --from=build /app/models/model /usr/local/models/model
COPY --from=build /app/target/release/bin /usr/local/bin/t2v-rs
ENV ENABLE_CUDA false
ENV MODEL_PATH /usr/local/models/model/model_quantized.onnx
ENV TOKENIZER_PATH /usr/local/models/model/tokenizer.json
CMD ["/usr/local/bin/t2v-rs"]