webhooks-kj / Dockerfile
uncertainrods's picture
Update Dockerfile
c2f2dbc verified
raw
history blame contribute delete
965 Bytes
# Use the official Python 3.10 slim image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Set environment variables
# Prevents Python from writing .pyc files and ensures logs are flushed to terminal
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install system dependencies if needed (none required for this specific script)
# RUN apt-get update && apt-get install -y --no-install-recommends gcc
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Hugging Face Spaces runs on port 7860 by default
# We expose this port for documentation
EXPOSE 7860
# Start the FastAPI application using uvicorn
# We use main:app (assuming your file is named main.py and the FastAPI instance is 'app')
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]