2023-03-03 22:45:20 +00:00
|
|
|
FROM python:3.10 as builder
|
2023-02-22 10:53:59 -06:00
|
|
|
|
2023-03-03 22:45:20 +00:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
2023-03-01 15:37:12 +00:00
|
|
|
PYTHONUNBUFFERED=1 \
|
2023-03-01 17:48:35 +00:00
|
|
|
PIP_NO_CACHE_DIR=true
|
2023-03-01 15:37:12 +00:00
|
|
|
|
2023-03-01 17:48:35 +00:00
|
|
|
RUN python -m venv /opt/venv
|
2023-03-03 22:45:20 +00:00
|
|
|
RUN /opt/venv/bin/pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
|
|
|
RUN /opt/venv/bin/pip install transformers tqdm numpy scikit-learn scipy nltk sentencepiece flask Pillow gunicorn
|
|
|
|
RUN /opt/venv/bin/pip install --no-deps sentence-transformers
|
|
|
|
|
|
|
|
FROM python:3.10-slim
|
|
|
|
|
2023-04-03 16:05:29 -04:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
2023-03-03 22:45:20 +00:00
|
|
|
COPY --from=builder /opt/venv /opt/venv
|
2023-03-01 17:48:35 +00:00
|
|
|
|
2023-03-03 22:45:20 +00:00
|
|
|
ENV TRANSFORMERS_CACHE=/cache \
|
|
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
PATH="/opt/venv/bin:$PATH"
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
2023-03-01 17:48:35 +00:00
|
|
|
|
2022-03-27 14:58:54 -05:00
|
|
|
COPY . .
|
2023-02-23 17:54:04 +02:00
|
|
|
|
2023-03-03 22:45:20 +00:00
|
|
|
CMD ["gunicorn", "src.main:server"]
|