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