2024-11-01 15:19:44 +03:00
|
|
|
# https://stackoverflow.com/a/57374374/2798461
|
|
|
|
|
2024-11-01 17:06:38 +03:00
|
|
|
#######################################################################################################################
|
2024-11-01 15:19:44 +03:00
|
|
|
FROM python:3.10-alpine AS dist
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY lib /app/lib
|
|
|
|
COPY requirements.txt /app
|
|
|
|
COPY src /app/src
|
|
|
|
|
|
|
|
|
2024-11-01 17:06:38 +03:00
|
|
|
#######################################################################################################################
|
2024-11-01 15:19:44 +03:00
|
|
|
FROM dist AS installation
|
|
|
|
|
|
|
|
RUN apk update
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
RUN pip install --no-index --find-links /app/lib nvidia-nccl-cu12
|
|
|
|
RUN apk add curl bash gcc g++ cmake make musl-dev
|
|
|
|
|
|
|
|
|
2024-11-01 17:06:38 +03:00
|
|
|
#######################################################################################################################
|
2024-11-01 15:19:44 +03:00
|
|
|
FROM installation AS building
|
|
|
|
|
|
|
|
RUN pip install -r requirements.txt
|
|
|
|
RUN apk del gcc g++ cmake make musl-dev
|
|
|
|
|
|
|
|
|
2024-11-01 17:06:38 +03:00
|
|
|
#######################################################################################################################
|
2024-11-01 15:19:44 +03:00
|
|
|
FROM building AS runner
|
|
|
|
|
|
|
|
RUN apk add libgomp libstdc++
|
|
|
|
|
|
|
|
RUN mkdir /app/nltk_data
|
|
|
|
RUN ln -s /app/nltk_data /root/nltk_data
|
|
|
|
|
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
|
|
|
|
ARG DATASET
|
2024-11-01 17:06:38 +03:00
|
|
|
ARG WEB_API_URL
|
2024-11-01 23:35:45 +03:00
|
|
|
ARG RABBITMQ_HOST
|
|
|
|
ARG RABBITMQ_PORT
|
|
|
|
ARG RABBITMQ_USER
|
|
|
|
ARG RABBITMQ_PASS
|
|
|
|
ARG RABBITMQ_QUEUE
|
2024-11-01 15:19:44 +03:00
|
|
|
|
2024-11-04 00:17:50 +03:00
|
|
|
ENV PORT=8080 \
|
2024-11-01 15:19:44 +03:00
|
|
|
DATASET=${DATASET} \
|
|
|
|
WORKING_DIR=/app/nltk_data \
|
|
|
|
FUCKING_DIR=/usr/local/lib/python3.10/site-packages/spam_detector_ai/models \
|
2024-11-01 17:06:38 +03:00
|
|
|
MODELS_DIR=/app/models \
|
2024-11-01 23:35:45 +03:00
|
|
|
WEB_API_URL=${WEB_API_URL} \
|
|
|
|
RABBITMQ_HOST=${RABBITMQ_HOST} \
|
|
|
|
RABBITMQ_PORT=${RABBITMQ_PORT} \
|
|
|
|
RABBITMQ_USER=${RABBITMQ_USER} \
|
|
|
|
RABBITMQ_PASS=${RABBITMQ_PASS} \
|
|
|
|
RABBITMQ_QUEUE=${RABBITMQ_QUEUE}
|
2024-11-01 15:19:44 +03:00
|
|
|
|
|
|
|
RUN python3 -m src.preparer
|
|
|
|
|
2024-11-04 00:17:50 +03:00
|
|
|
ENTRYPOINT [ "bash", "-c", "while true; do sleep 1; done" ]
|