FROM node:18-slim # Install OpenJDK 17 (required for apk-mitm or other Java-based tools) RUN apt-get update && apt-get install -y \ openjdk-17-jdk \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy package.json and package-lock.json (if it exists) COPY package*.json ./ # Install global apk-mitm and project dependencies as root RUN npm install -g apk-mitm RUN npm install # Copy the rest of the application files COPY . . # Create uploads directory and set permissions RUN mkdir -p /app/uploads && chown -R node:node /app # Switch to node user for running the app USER node # Set environment variable for port ENV PORT=7860 # Expose the port EXPOSE 7860 # Start the application CMD ["npm", "start"]