mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 01:11:00 +00:00
Optimize pip install in Dockerfile to minimize image size
This commit is contained in:
parent
6c5f27d7f1
commit
842a2860af
2 changed files with 4 additions and 4 deletions
|
@ -9,7 +9,7 @@ RUN apt-get update -qq \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt
|
&& rm -rf /var/lib/apt
|
||||||
|
|
||||||
RUN python -mvenv venv && ./venv/bin/pip install --upgrade pip
|
RUN python -mvenv venv && ./venv/bin/pip install --no-cache-dir --upgrade pip
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|
|
@ -13,17 +13,17 @@ RUN apt-get update -qq \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt
|
&& rm -rf /var/lib/apt
|
||||||
|
|
||||||
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 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 . .
|
COPY . .
|
||||||
|
|
||||||
RUN if [ "$with_models" = "true" ]; then \
|
RUN if [ "$with_models" = "true" ]; then \
|
||||||
# install only the dependencies first
|
# install only the dependencies first
|
||||||
pip3 install -e .; \
|
pip3 install --no-cache-dir -e .; \
|
||||||
# initialize the language models
|
# initialize the language models
|
||||||
if [ ! -z "$models" ]; then \
|
if [ ! -z "$models" ]; then \
|
||||||
./scripts/install_models.py --load_only_lang_codes "$models"; \
|
./scripts/install_models.py --load_only_lang_codes "$models"; \
|
||||||
|
|
Loading…
Reference in a new issue