forked from TabbyML/tabby
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rocm.Dockerfile
85 lines (66 loc) · 2.29 KB
/
rocm.Dockerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Ubuntu version to be used as base
ARG UBUNTU_VERSION=jammy
# URL to the amdgpu-install debian package
ARG AMDGPU_INSTALL_URL=https://repo.radeon.com/amdgpu-install/6.0/ubuntu/${UBUNTU_VERSION}/amdgpu-install_6.0.60000-1_all.deb
FROM ubuntu:${UBUNTU_VERSION} as hipblas_base
ARG AMDGPU_INSTALL_URL
ENV PATH="/opt/rocm/bin:${PATH}"
ENV LD_LIBRARY_PATH="/opt/rocm/lib:${LD_LIBRARY_PATH}"
# Install ROCm
RUN apt-get update && \
apt-get install -y curl ca-certificates && \
curl -Lo /tmp/amdgpu-install.deb "${AMDGPU_INSTALL_URL}" && \
apt-get install -y /tmp/amdgpu-install.deb && \
rm /tmp/amdgpu-install.deb && \
apt-get update && \
apt-get install -y --no-install-recommends hipblas rocblas comgr && \
apt-get purge -y curl && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM hipblas_base as build
# Rust toolchain version
ARG RUST_TOOLCHAIN=stable
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
pkg-config \
libssl-dev \
protobuf-compiler \
git \
cmake \
hipblas-dev \
rocblas-dev \
rocm-device-libs \
build-essential \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# setup rust.
RUN curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --no-modify-path --default-toolchain ${RUST_TOOLCHAIN} -y && \
/root/.cargo/bin/cargo --version
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /root/workspace
RUN mkdir -p /opt/tabby/bin
RUN mkdir -p target
COPY . .
ARG AMDGPU_TARGETS
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo build -vv --features rocm --release --package tabby && \
cp target/release/tabby /opt/tabby/bin/
RUN ldd /opt/tabby/bin/tabby 2>&1 | grep rocm > /dev/null
FROM hipblas_base as runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Disable safe directory in docker
# Context: https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
RUN git config --system --add safe.directory "*"
COPY --from=build /opt/tabby /opt/tabby
ENV TABBY_ROOT=/data
ENTRYPOINT ["/opt/tabby/bin/tabby"]