mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-27 17:40:32 +00:00
Merge pull request #440 from PeterDaveHello/Docker
Speed up Docker image build and make Docker image smaller
This commit is contained in:
commit
14e6e4e13e
2 changed files with 6 additions and 8 deletions
|
@ -5,12 +5,11 @@ WORKDIR /app
|
|||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get -qqq install --no-install-recommends -y pkg-config gcc g++ \
|
||||
&& apt-get upgrade --assume-yes \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt
|
||||
|
||||
RUN apt-get update && apt-get upgrade --assume-yes
|
||||
|
||||
RUN python -mvenv venv && ./venv/bin/pip install --upgrade pip
|
||||
RUN python -mvenv venv && ./venv/bin/pip install --no-cache-dir --upgrade pip
|
||||
|
||||
COPY . .
|
||||
|
||||
|
|
|
@ -9,22 +9,21 @@ 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 upgrade --assume-yes \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt
|
||||
|
||||
RUN apt-get update && apt-get upgrade --assume-yes
|
||||
|
||||
RUN pip3 install --upgrade pip && apt-get remove python3-pip --assume-yes
|
||||
RUN pip3 install --no-cache-dir --upgrade pip && apt-get remove python3-pip --assume-yes
|
||||
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
RUN pip3 install torch==1.12.0+cu116 -f https://download.pytorch.org/whl/torch_stable.html
|
||||
RUN pip3 install --no-cache-dir torch==1.12.0+cu116 -f https://download.pytorch.org/whl/torch_stable.html
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN if [ "$with_models" = "true" ]; then \
|
||||
# install only the dependencies first
|
||||
pip3 install -e .; \
|
||||
pip3 install --no-cache-dir -e .; \
|
||||
# initialize the language models
|
||||
if [ ! -z "$models" ]; then \
|
||||
./scripts/install_models.py --load_only_lang_codes "$models"; \
|
||||
|
|
Loading…
Reference in a new issue