FROM python:3.11 WORKDIR /app # Install system dependencies including Redis server # Install Node.js for frontend build RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - RUN apt-get update && apt-get install -y \ redis-server \ nodejs \ curl \ && rm -rf /var/lib/apt/lists/* # Copy and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy package files for frontend COPY frontend/package*.json ./frontend/ # Install frontend dependencies RUN cd frontend && npm install # Copy all files COPY . . # Build frontend RUN cd frontend && npm run build # Create logs directory RUN mkdir -p logs # Expose port EXPOSE 7860 # Start Redis server in background and then start the application with gunicorn CMD ["sh", "-c", "redis-server --daemonize yes && gunicorn --config gunicorn.conf.py 'backend.app:create_app()'"]