# Start with Python 3.12 image FROM python:3.12-slim # Install Node.js 18.x and Supervisor RUN apt-get update && apt-get install -y curl supervisor && \ curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Verify installations RUN python --version && node --version && npm --version # Set working directory WORKDIR /app # Copy your application files COPY . . # Install any needed packages specified in requirements.txt and package.json RUN pip install --no-cache-dir -r requirements.txt RUN npm install # Create a Supervisor configuration file RUN echo "[supervisord]\n\ nodaemon=true\n\ \n\ [program:python_server]\n\ command=python python_server.py\n\ stdout_logfile=/dev/stdout\n\ stdout_logfile_maxbytes=0\n\ stderr_logfile=/dev/stderr\n\ stderr_logfile_maxbytes=0\n\ \n\ [program:node_server]\n\ command=node node_server.js\n\ stdout_logfile=/dev/stdout\n\ stdout_logfile_maxbytes=0\n\ stderr_logfile=/dev/stderr\n\ stderr_logfile_maxbytes=0" > /etc/supervisor/conf.d/supervisord.conf # Expose ports for both servers EXPOSE 3000 5000 # Start Supervisor to run both servers CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]