# Use Node.js 18 base image FROM node:18 # Install build tools for node-pty, python3-pip, and sudo RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ make \ g++ \ sudo \ && rm -rf /var/lib/apt/lists/* # Allow root to use sudo without a password (optional, since we're already root) RUN echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/root # Set working directory WORKDIR /app # Copy package.json and install dependencies COPY package.json . RUN npm install # Copy application files COPY . . # Create run.sh script RUN echo '#!/bin/bash' > run.sh && \ echo 'docker run --security-opt no-new-privileges=false -p 7860:7860 ' >> run.sh && \ chmod +x run.sh # Ensure the container runs as root USER root # Expose port 7860 EXPOSE 7860 # Start the application CMD ["npm", "start"]