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 -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 | |
# Make the startup script executable | |
RUN chmod +x start_app.py | |
# Expose port | |
EXPOSE 7860 | |
# Start Redis server in background and then start the application | |
CMD ["sh", "-c", "redis-server --daemonize yes && python start_app.py"] |