File size: 862 Bytes
d95bed5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8fc8f5c
 
d95bed5
 
 
 
 
8fc8f5c
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
# Use an official Python runtime as a parent image
FROM python:3.9-slim-buster

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
# This includes main.py, requirements.txt, and the models/ directory
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Create a directory for your models if it doesn't exist
# (though it should be copied from local)
RUN mkdir -p models

# Expose the port FastAPI will run on. Hugging Face Spaces often expects 
# port 7860 for web apps.
EXPOSE 7860

# Command to run the Uvicorn server
# The --host 0.0.0.0 makes the server accessible from outside the 
# container
# The --port 7860 matches the EXPOSE instruction
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]