# https://stackoverflow.com/a/57374374/2798461 ####################################################################################################################### FROM python:3.10-alpine AS dist ENV PYTHONUNBUFFERED=1 WORKDIR /app COPY lib /app/lib COPY requirements.txt /app COPY src /app/src ####################################################################################################################### 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 ####################################################################################################################### FROM installation AS building RUN pip install -r requirements.txt RUN apk del gcc g++ cmake make musl-dev ####################################################################################################################### 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 ARG PORT ARG WEB_API_URL ARG RABBITMQ_HOST ARG RABBITMQ_PORT ARG RABBITMQ_USER ARG RABBITMQ_PASS ARG RABBITMQ_QUEUE ENV PORT=${PORT} \ DATASET=${DATASET} \ WORKING_DIR=/app/nltk_data \ FUCKING_DIR=/usr/local/lib/python3.10/site-packages/spam_detector_ai/models \ MODELS_DIR=/app/models \ 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} RUN python3 -m src.preparer ENTRYPOINT [ "bash", "-c", "while true; do sleep 1; done" ]