nikhmr1235's picture
Create Dockerfile
224666a verified
raw
history blame contribute delete
792 Bytes
# Use a slim Python image for smaller size
FROM python:3.10-slim-buster
# Set the working directory in the container
WORKDIR /app
# Copy only requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your application code
COPY . .
# Expose the port Uvicorn will run on
# Hugging Face Spaces exposes port 7860 by default for external access
# But your Uvicorn server should still run on a specific port internally, e.g., 8000
EXPOSE 8000
# Command to run your FastAPI application using Uvicorn
# The --host 0.0.0.0 makes it accessible from outside the container
# The --port 8000 is your internal container port
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]