Use requirements.txt file to install python dependencies in ML image

This commit is contained in:
Olly Welch
2023-03-01 12:23:38 +00:00
parent cbe9289826
commit 32e706c7f3
2 changed files with 37 additions and 3 deletions

View File

@@ -4,10 +4,11 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=true
COPY requirements.txt ./
RUN python -m venv /opt/venv && \
/opt/venv/bin/pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html && \
/opt/venv/bin/pip install transformers tqdm numpy scikit-learn scipy nltk sentencepiece flask Pillow gunicorn && \
/opt/venv/bin/pip install --no-deps sentence-transformers
/opt/venv/bin/pip install --upgrade pip setuptools wheel && \
/opt/venv/bin/pip install --no-deps -r requirements.txt
FROM python:3.10-slim