FROM python:3.11-slim-bullseye RUN apt update RUN apt install -y build-essential RUN pip install gunicorn==20.1.0 RUN pip install typing-extensions RUN pip install scikit-learn==1.3.2 RUN pip install topic-wizard==1.1.0 RUN pip install joblib==1.2.0 RUN pip install turftopic==0.4.5 RUN pip install gensim==4.3.2 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH COPY --chown=user . $HOME/app RUN mkdir /home/user/numba_cache RUN chmod 777 /home/user/numba_cache ENV NUMBA_CACHE_DIR=/home/user/numba_cache # Set the working directory to the user's home directory WORKDIR $HOME/app EXPOSE 7860 CMD gunicorn --timeout 0 -b 0.0.0.0:7860 --workers=2 --threads=4 --worker-class=gthread main:server