mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-05 07:20:13 +01:00
38 lines
990 B
Docker
38 lines
990 B
Docker
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" ]
|