# Use an official Node.js runtime as a parent image FROM node:21 # Set the working directory in the container WORKDIR /app # Install Python and pip RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ && rm -rf /var/lib/apt/lists/* \ && pip3 install --no-cache-dir --upgrade pip # Upgrade pip to the latest version # Copy package.json COPY package.json ./ # Install frontend dependencies RUN npm install # Copy the rest of the application code COPY . . # Install backend dependencies RUN pip3 install --no-cache-dir -r requirements.txt # Build the Next.js app RUN npm run build # Make port 8000 available to the world outside this container EXPOSE 8000 # Set execute permissions for the start script RUN chmod +x start.sh # Use a non-root user RUN useradd -m appuser USER appuser # Run the script when the container launches CMD ["./start.sh"]