text-generation-inference/Dockerfile

76 lines
2.3 KiB
Docker
Raw Normal View History

# Rust builder
2024-02-19 09:19:23 +00:00
FROM lukemathwalker/cargo-chef:latest-rust-1.75 AS chef
2023-03-03 14:07:27 +00:00
WORKDIR /usr/src
FROM chef as planner
COPY Cargo.toml Cargo.toml
COPY rust-toolchain.toml rust-toolchain.toml
COPY proto proto
2023-05-09 12:39:59 +00:00
COPY benchmark benchmark
2023-03-03 14:07:27 +00:00
COPY router router
COPY launcher launcher
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
2023-02-13 12:02:45 +00:00
RUN PROTOC_ZIP=protoc-21.12-linux-x86_64.zip && \
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \
rm -f $PROTOC_ZIP
2022-10-14 13:56:21 +00:00
2023-03-03 14:07:27 +00:00
COPY --from=planner /usr/src/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
2022-10-14 13:56:21 +00:00
2023-03-03 14:07:27 +00:00
COPY Cargo.toml Cargo.toml
COPY rust-toolchain.toml rust-toolchain.toml
2022-10-14 13:56:21 +00:00
COPY proto proto
2023-05-09 12:39:59 +00:00
COPY benchmark benchmark
2022-10-14 13:56:21 +00:00
COPY router router
2022-10-18 13:19:03 +00:00
COPY launcher launcher
2023-03-03 14:07:27 +00:00
RUN cargo build --release
2022-10-18 13:19:03 +00:00
# Text Generation Inference base image
2024-02-19 09:19:23 +00:00
FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1:latest as base
# Text Generation Inference base env
ENV HUGGINGFACE_HUB_CACHE=/data \
2023-02-18 13:04:11 +00:00
HF_HUB_ENABLE_HF_TRANSFER=1 \
PORT=80
2022-10-14 13:56:21 +00:00
# libssl.so.1.1 is not installed on Ubuntu 22.04 by default, install it
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && \
dpkg -i ./libssl1.1_1.1.1f-1ubuntu2_amd64.deb
WORKDIR /usr/src
2023-03-24 13:02:14 +00:00
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libssl-dev \
ca-certificates \
make \
curl \
&& rm -rf /var/lib/apt/lists/*
2022-10-14 13:56:21 +00:00
# Install server
COPY proto proto
2022-10-14 13:56:21 +00:00
COPY server server
COPY server/Makefile server/Makefile
2022-10-14 13:56:21 +00:00
RUN cd server && \
make gen-server && \
pip install -r requirements.txt && \
2024-02-25 12:07:47 +00:00
pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.14.0 && \
pip install . --no-cache-dir
2022-10-14 13:56:21 +00:00
# Install benchmarker
COPY --from=builder /usr/src/target/release/text-generation-benchmark /usr/local/bin/text-generation-benchmark
2022-10-14 13:56:21 +00:00
# Install router
2023-03-03 14:07:27 +00:00
COPY --from=builder /usr/src/target/release/text-generation-router /usr/local/bin/text-generation-router
# Install launcher
2023-03-03 14:07:27 +00:00
COPY --from=builder /usr/src/target/release/text-generation-launcher /usr/local/bin/text-generation-launcher
2022-10-14 13:56:21 +00:00
# Final image
FROM base
ENTRYPOINT ["text-generation-launcher"]
CMD ["--json-output"]