# Use an official Python runtime as a parent image FROM nvidia/cuda:12.3.1-runtime-ubuntu22.04 # Set Python to use unbuffered mode ENV PYTHONUNBUFFERED 1 RUN apt-get update && \ apt-get install -y --no-install-recommends python3-pip python3-dev && \ rm -rf /var/lib/apt/lists/* # Set the working directory in the container RUN mkdir /var/www ENV HOME /var/www WORKDIR /var/www # Copy the current directory contents into the container at /app COPY . /var/www RUN pip install -r requirements.txt RUN pip install torch==1.12.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html # RUN python -c "import nltk; nltk.download('punkt')" # RUN python -c "import nltk; nltk.download('stopwords')" # RUN python -m nltk.downloader -d $HOME/nltk_data punkt stopwords EXPOSE 7866 RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \ HF_TOKEN=$(cat /run/secrets/HF_TOKEN) && export HF_TOKEN # Define environment variable ENV FLASK_APP app.py \ HF_MODEL_NAME "muryshev/e5_large_rus_finetuned_20240120_122822_ep6" # Run app.py when the container launches CMD flask run --host=0.0.0.0 --port=7869