Spaces:
Running
Running
FROM python:3.9-slim | |
WORKDIR /app | |
# Install dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application files | |
COPY . . | |
# Create necessary directories | |
RUN mkdir -p flask_session | |
# Set permissions for flask_session directory and touch API key file | |
RUN chmod -R 777 flask_session && \ | |
touch api_key.txt && \ | |
chmod 666 api_key.txt | |
# Set environment variables | |
ENV FLASK_APP=app.py | |
ENV FLASK_ENV=production | |
ENV PORT=7860 | |
# Expose the port Hugging Face Spaces uses | |
EXPOSE 7860 | |
# Command to run the application | |
CMD gunicorn --bind 0.0.0.0:7860 app:app | |