2023-01-25 10:06:02 +03:00
|
|
|
FROM python:3.9-slim
|
|
|
|
|
|
|
|
ARG NAME
|
2024-04-18 10:42:18 +03:00
|
|
|
ARG NLP_CONF_FILE=presidio_analyzer/conf/transformers.yaml
|
2024-05-01 15:01:50 +03:00
|
|
|
ARG ANALYZER_CONF_FILE=presidio_analyzer/conf/default_analyzer.yaml
|
|
|
|
ARG RECOGNIZER_REGISTRY_CONF_FILE=presidio_analyzer/conf/default_recognizers.yaml
|
2023-01-25 10:06:02 +03:00
|
|
|
ENV PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /usr/bin/${NAME}
|
|
|
|
|
2024-05-01 15:01:50 +03:00
|
|
|
ENV ANALYZER_CONF_FILE=${ANALYZER_CONF_FILE}
|
|
|
|
ENV RECOGNIZER_REGISTRY_CONF_FILE=${RECOGNIZER_REGISTRY_CONF_FILE}
|
|
|
|
ENV NLP_CONF_FILE=${NLP_CONF_FILE}
|
|
|
|
|
|
|
|
COPY ${ANALYZER_CONF_FILE} /usr/bin/${NAME}/${ANALYZER_CONF_FILE}
|
|
|
|
COPY ${RECOGNIZER_REGISTRY_CONF_FILE} /usr/bin/${NAME}/${RECOGNIZER_REGISTRY_CONF_FILE}
|
|
|
|
COPY ${NLP_CONF_FILE} /usr/bin/${NAME}/${NLP_CONF_FILE}
|
|
|
|
|
2024-06-02 12:59:21 +03:00
|
|
|
COPY ./pyproject.toml /usr/bin/${NAME}/
|
|
|
|
COPY ./README.md /usr/bin/${NAME}/
|
|
|
|
RUN pip install poetry && poetry install -E server -E transformers
|
|
|
|
|
|
|
|
RUN poetry add torch transformers huggingface_hub --no-lock
|
2023-01-25 10:06:02 +03:00
|
|
|
|
2024-05-01 15:01:50 +03:00
|
|
|
# install nlp models specified in NLP_CONF_FILE
|
2023-01-25 10:06:02 +03:00
|
|
|
COPY ./install_nlp_models.py /usr/bin/${NAME}/
|
|
|
|
|
2024-06-02 12:59:21 +03:00
|
|
|
RUN poetry run python install_nlp_models.py --conf_file ${NLP_CONF_FILE}
|
2023-01-25 10:06:02 +03:00
|
|
|
|
|
|
|
COPY . /usr/bin/${NAME}/
|
|
|
|
EXPOSE ${PORT}
|
2024-06-02 12:59:21 +03:00
|
|
|
CMD poetry run python app.py --host 0.0.0.0
|