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