Added models include option in docker build

This commit is contained in:
Piti Cookie 2022-03-31 07:21:20 -07:00
commit e828658332
2 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,7 @@
FROM python:3.8.12-slim-bullseye
ARG with_models=false
ARG models=
WORKDIR /app
@ -14,14 +15,17 @@ RUN pip install --upgrade pip
COPY . .
# check for offline build
RUN if [ "$with_models" = "true" ]; then \
# install only the dependencies first
pip install -e .; \
# initialize the language models
./install_models.py; \
if [ ! -z "$models" ]; then \
./install_models.py --load_only_lang_codes "$models"; \
else \
./install_models.py; \
fi \
fi
# Install package from source code
RUN pip install . \
&& pip cache purge