mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-05-04 12:24:52 +00:00
Add CUDA docker version
This commit is contained in:
parent
8247444fb2
commit
89dde2d468
3 changed files with 59 additions and 0 deletions
37
docker/Dockerfile.cuda
Normal file
37
docker/Dockerfile.cuda
Normal file
|
@ -0,0 +1,37 @@
|
|||
FROM nvidia/cuda:11.2.2-devel-ubuntu20.04
|
||||
|
||||
ENV ARGOS_DEVICE_TYPE cuda
|
||||
ARG with_models=true
|
||||
ARG models=
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get -qqq install --no-install-recommends -y libicu-dev libaspell-dev libcairo2 libcairo2-dev pkg-config gcc g++ python3.8-dev python3-pip libpython3.8-dev\
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt
|
||||
|
||||
RUN pip3 install --upgrade pip
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
RUN if [ "$with_models" = "true" ]; then \
|
||||
# install only the dependencies first
|
||||
pip3 install -e .; \
|
||||
# initialize the language models
|
||||
if [ ! -z "$models" ]; then \
|
||||
./install_models.py --load_only_lang_codes "$models"; \
|
||||
else \
|
||||
./install_models.py; \
|
||||
fi \
|
||||
fi
|
||||
|
||||
# Install package from source code
|
||||
RUN pip3 install . \
|
||||
&& pip3 cache purge
|
||||
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT [ "libretranslate", "--host", "0.0.0.0" ]
|
Loading…
Add table
Add a link
Reference in a new issue