APIs / Dockerfile
hfariborzi's picture
Create Dockerfile
4bc0ae4 verified
# Use an official Python runtime as a base image
FROM python:3.12-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the requirements file into the container
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY . .
# Ensure environment variables are loaded
ENV PYTHONUNBUFFERED=1
# Expose the application port (Hugging Face typically uses 7860)
EXPOSE 7860
# Run the FastAPI application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]