Spaces:
Sleeping
Sleeping
File size: 1,014 Bytes
9fcc41f 8af33a6 5fc0408 2f0c092 5fc0408 6c73a7c 76d1dc4 ae13880 46c29f0 62adfb4 46c29f0 d2c7ae1 b84d436 46c29f0 b84d436 62adfb4 46c29f0 b84d436 5fc0408 46c29f0 62adfb4 94f266a 834780d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
FROM python:3.9
RUN pwd && ls -l
# Create a user with UID 1000
RUN useradd -m -u 1000 user
# Install PyTorch
RUN pip install torch torchvision torchaudio
# Copy the requirements file to the /code directory
COPY ./requirements.txt /code/requirements.txt
# Install the Python dependencies with root and clean up cache
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt && rm -rf /root/.cache
# Switch to the user
USER user
# Set the working directory and user environment variables
ENV PATH=/home/user/.local/bin:$PATH
# Switch to the user's home directory
WORKDIR /home/user
# Copy the application files into the user's home directory
COPY --chown=user:user . /home/user
# Set the working directory for the application
WORKDIR /home/user
RUN pwd && ls -l
# Start the application using gunicorn with increased log level
CMD ["gunicorn", "main:app", "--workers", "4", "--worker-class", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--timeout", "300", "--log-level", "debug"]
|