Spaces:
Runtime error
Runtime error
# 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 | |
ENV PATH="/var/www/.local/bin:${PATH}" | |
# Create a non-root user | |
RUN useradd -m -u 1000 -U -s /bin/bash myuser | |
# Install dependencies | |
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 | |
# Change ownership of /var/www to the non-root user | |
RUN chown -R myuser:myuser /var/www | |
# Switch to the non-root user | |
USER myuser | |
# Copy the current directory contents into the container at /var/www | |
COPY . /var/www | |
# Install Python dependencies | |
RUN pip install --user -r requirements.txt | |
RUN pip install --user torch==1.12.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html | |
# Expose the port | |
EXPOSE 7860 | |
RUN mkdir /var/www/logs | |
# Set environment variables | |
ENV FLASK_APP=app.py \ | |
HF_MODEL_NAME="muryshev/e5_large_rus_finetuned_20240202_204910_ep8" \ | |
ENABLE_LOGS=0 \ | |
LOGS_BASE_PATH="/var/www/logs" | |
# Run app.py when the container launches | |
CMD python3 -m flask run --host=0.0.0.0 --port=7860 | |