2023-06-06 12:46:17 +00:00
|
|
|
FROM ghcr.io/opennmt/ctranslate2:3.15.0-ubuntu20.04-cuda11.2 as source
|
2023-05-26 01:18:22 +00:00
|
|
|
FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 as builder
|
|
|
|
|
2023-05-27 07:05:56 +00:00
|
|
|
ENV CTRANSLATE2_ROOT=/opt/ctranslate2
|
|
|
|
COPY --from=source $CTRANSLATE2_ROOT $CTRANSLATE2_ROOT
|
|
|
|
|
2023-05-26 01:18:22 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y --no-install-recommends \
|
2023-05-27 07:05:56 +00:00
|
|
|
curl \
|
2023-05-26 01:18:22 +00:00
|
|
|
pkg-config \
|
|
|
|
libssl-dev \
|
2023-06-11 05:46:25 +00:00
|
|
|
protobuf-compiler \
|
2023-05-26 01:18:22 +00:00
|
|
|
&& \
|
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# setup rust.
|
2023-05-27 07:05:56 +00:00
|
|
|
RUN curl https://sh.rustup.rs -sSf | bash -s -- -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
|
|
|
|
COPY Cargo.toml Cargo.toml
|
|
|
|
COPY Cargo.lock Cargo.lock
|
2023-05-26 01:18:22 +00:00
|
|
|
COPY crates crates
|
|
|
|
|
|
|
|
RUN mkdir -p /opt/tabby/bin
|
|
|
|
RUN mkdir -p /opt/tabby/lib
|
2023-05-26 18:23:14 +00:00
|
|
|
RUN mkdir -p target
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
2023-05-27 21:31:27 +00:00
|
|
|
--mount=type=cache,target=/root/workspace/target \
|
2023-05-27 07:05:56 +00:00
|
|
|
cargo build --features link_shared --release && \
|
|
|
|
cp target/release/tabby /opt/tabby/bin/
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2023-06-06 12:46:17 +00:00
|
|
|
FROM ghcr.io/opennmt/ctranslate2:3.15.0-ubuntu20.04-cuda11.2
|
2023-05-26 01:18:22 +00:00
|
|
|
|
2023-05-31 23:27:55 +00:00
|
|
|
COPY --from=builder /opt/tabby /opt/tabby
|
2023-05-26 01:18:22 +00:00
|
|
|
|
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"]
|