2023-10-27 20:41:22 +00:00
|
|
|
ARG UBUNTU_VERSION=22.04
|
|
|
|
# This needs to generally match the container host's environment.
|
2024-02-26 21:13:40 +00:00
|
|
|
ARG ROCM_VERSION=5.7.1
|
|
|
|
# Target the ROCM build image
|
|
|
|
ARG BASE_ROCM_DEV_CONTAINER=rocm/dev-ubuntu-${UBUNTU_VERSION}:${ROCM_VERSION}-complete
|
|
|
|
# Target the ROCM runtime image
|
|
|
|
ARG BASE_ROCM_RUN_CONTAINER=rocm/dev-ubuntu-${UBUNTU_VERSION}:${ROCM_VERSION}
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2024-02-26 21:13:40 +00:00
|
|
|
FROM ${BASE_ROCM_DEV_CONTAINER} AS build
|
2023-05-27 07:05:56 +00:00
|
|
|
|
2023-11-19 22:08:57 +00:00
|
|
|
# Rust toolchain version
|
2023-11-30 15:36:42 +00:00
|
|
|
ARG RUST_TOOLCHAIN=stable
|
2023-11-19 22:08:57 +00:00
|
|
|
|
2023-09-08 02:23:57 +00:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2023-05-26 01:18:22 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
2024-02-26 21:13:40 +00:00
|
|
|
curl \
|
|
|
|
pkg-config \
|
|
|
|
libssl-dev \
|
|
|
|
protobuf-compiler \
|
|
|
|
git \
|
|
|
|
cmake \
|
|
|
|
&& \
|
2023-05-26 01:18:22 +00:00
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# setup rust.
|
2023-11-19 00:06:56 +00:00
|
|
|
RUN curl https://sh.rustup.rs -sSf | bash -s -- --default-toolchain ${RUST_TOOLCHAIN} -y
|
2023-05-26 01:18:22 +00:00
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
|
2023-05-27 21:31:27 +00:00
|
|
|
WORKDIR /root/workspace
|
2023-05-26 01:18:22 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /opt/tabby/bin
|
|
|
|
RUN mkdir -p /opt/tabby/lib
|
2023-05-26 18:23:14 +00:00
|
|
|
RUN mkdir -p target
|
|
|
|
|
2023-12-13 07:59:04 +00:00
|
|
|
COPY . .
|
|
|
|
|
2023-05-26 18:23:14 +00:00
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
2023-05-27 21:31:27 +00:00
|
|
|
--mount=type=cache,target=/root/workspace/target \
|
2024-05-06 17:57:20 +00:00
|
|
|
cargo build --no-default-features --features rocm,prod --release --package tabby && \
|
2024-05-21 03:45:10 +00:00
|
|
|
cp target/release/llama-server /opt/tabby/bin/ && \
|
2023-05-27 07:05:56 +00:00
|
|
|
cp target/release/tabby /opt/tabby/bin/
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2024-05-14 02:49:24 +00:00
|
|
|
# For compatibility with the legacy cpu build.
|
2024-05-21 03:45:10 +00:00
|
|
|
RUN cp /opt/tabby/bin/tabby /opt/tabby/bin/tabby-cpu
|
2024-05-14 02:49:24 +00:00
|
|
|
|
2024-02-26 21:13:40 +00:00
|
|
|
FROM ${BASE_ROCM_RUN_CONTAINER} AS runtime
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2023-06-24 16:23:16 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
2024-02-26 21:13:40 +00:00
|
|
|
git \
|
2024-05-03 17:57:55 +00:00
|
|
|
curl \
|
2024-02-26 21:13:40 +00:00
|
|
|
openssh-client \
|
|
|
|
ca-certificates \
|
|
|
|
libssl3 \
|
|
|
|
rocblas \
|
|
|
|
hipblas \
|
|
|
|
&& \
|
2023-06-24 16:23:16 +00:00
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2023-10-16 21:21:09 +00:00
|
|
|
# Disable safe directory in docker
|
|
|
|
# Context: https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
|
|
|
|
RUN git config --system --add safe.directory "*"
|
|
|
|
|
2023-12-11 09:48:38 +00:00
|
|
|
# Automatic platform ARGs in the global scope
|
|
|
|
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
2023-10-27 20:41:22 +00:00
|
|
|
COPY --from=build /opt/tabby /opt/tabby
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2024-01-17 17:03:23 +00:00
|
|
|
ENV PATH="$PATH:/opt/tabby/bin"
|
2023-05-31 23:27:55 +00:00
|
|
|
ENV TABBY_ROOT=/data
|
2023-05-26 01:18:22 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/opt/tabby/bin/tabby"]
|