spam-detector/Dockerfile

47 lines
923 B
Docker
Raw Normal View History

# 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
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
RUN python3 -m src.preparer
ENTRYPOINT [ "bash", "-c", "while true; do sleep 1; done" ]