File size: 1,292 Bytes
f027036 0720337 5ba0e1d 92a09c6 0720337 c703b31 0720337 9d551db 0720337 92a09c6 c703b31 5ba0e1d 92a09c6 0720337 9d551db 5ba0e1d |
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 37 38 39 40 41 42 43 44 45 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
# Use the official Python 3.10 slim image as the base image
FROM tiangolo/uvicorn-gunicorn:python3.10-slim
# Install necessary tools
USER root
RUN apt-get update && apt-get install -y wget tar
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Create necessary directories and set permissions
RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache
RUN mkdir -p /home/user/.local && chown -R user:user /home/user/.local
# 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
# Set the working directory to the user's home directory
WORKDIR /home/user/app
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip
# Copy the current directory contents into the container at /home/user/app
COPY --chown=user . .
# List the contents of the working directory to debug
RUN ls -la
# Install the dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Expose the port the app runs on
EXPOSE 7860
# Start the FastAPI app on port 7860
CMD ["fastapi", "run", "main.py", "--host", "0.0.0.0", "--port", "7860"]
|