# Use an official Python runtime as a parent image | |
FROM python:3.11-slim | |
# Set working directory in the container | |
WORKDIR /app | |
# Copy requirements file | |
COPY requirements.txt . | |
# Install system dependencies and Python packages | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& pip install --no-cache-dir -r requirements.txt | |
# Copy the entire application code | |
COPY . . | |
# Expose the port Flask will run on | |
# EXPOSE 5000 | |
EXPOSE 7860 | |
ENV SPACE_URL=https://multitransformer-tonic-discharge-guard.hf.space | |
# Set environment variables (optional, can be overridden in Hugging Face Spaces) | |
ENV FLASK_ENV=production | |
ENV PYTHONUNBUFFERED=1 | |
# Command to run the Flask app | |
CMD ["python", "app.py"] |