File size: 690 Bytes
85809ec
 
 
 
 
 
 
 
 
 
 
 
 
 
6ba1d2f
 
 
85809ec
 
 
 
 
 
 
 
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
# Use a Python base image
FROM python:3.9-slim-buster

# Create a non-root user for security best practices
RUN useradd -m -u 1000 user
USER user

# Set the working directory inside the container
WORKDIR /app

# Copy the requirements file and install dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Add the user's local bin directory to the PATH
ENV PATH="/home/user/.local/bin:$PATH"

# Copy your application code
COPY --chown=user:user . .

# Expose the port Hugging Face Spaces expects (7860)
EXPOSE 7860

# Command to run your FastAPI application with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]