Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files123445677989101211121415161718131415161718192420212227282923242531262728342930313233344035423637# Use an official Python runtime as a parent imageFROM python:3.9-slim
# Set environment variables for Python and Matplotlib# Set environment variables for PythonENV PYTHONDONTWRITEBYTECODE 1ENV PYTHONUNBUFFERED 1ENV MPLCONFIGDIR=/app/.config/matplotlib
# Set the working directory inside the container# Set the working directoryWORKDIR /app
# Install system dependencies required by OpenCV and other libraries# Install system dependencies, including libgompRUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ libgl1-mesa-glx \ libgomp1 \ && rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container at /appCOPY requirements.txt /app/
# Install the dependencies specified in requirements.txt# Install any needed packages specified in requirements.txtRUN pip install --no-cache-dir -r requirements.txt
# Create necessary directories and set proper permissionsRUN mkdir -p /app/uploads /app/static/uploads /app/static/results /tmp/flask_sessions /app/flask_sessions /app/models /app/.config/matplotlib && \ chmod -R 777 /app/uploads /app/static/uploads /app/static/results /tmp/flask_sessions /app/flask_sessions /app/models /app/.config/matplotlib# Create directories for session storage and uploadsRUN mkdir -p /app/flask_sessions /app/uploads && chmod -R 777 /app/flask_sessions /app/uploads
# Copy the entire application code to /app# Copy the rest of the application code to /appCOPY . /app/
# Expose the port used by the Flask app# Expose the port that the app runs onEXPOSE 7860
# Set environment variables for FlaskENV FLASK_APP=app.pyENV FLASK_ENV=productionENV SESSION_FILE_DIR=/app/flask_sessions
# Run the application with Gunicorn, setting workers and timeout# Command to run the Flask app using GunicornCMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]Dockerfile+11-17