| # Base image: Node.js version 18 (which supports the required Node.js version 7.6.0+) | |
| FROM node:18 | |
| # Set working directory | |
| WORKDIR /app | |
| # Clone the Node-Web-Console repository | |
| RUN git clone https://github.com/ChrisCindy/node-web-console.git . | |
| # Ensure correct permissions for the /app/static directory | |
| RUN mkdir -p /app/static && chmod -R 777 /app/static | |
| # Install pm2 globally | |
| RUN npm install -g pm2 | |
| # Install dependencies | |
| RUN npm install | |
| # Expose the port the app will run on (3000 by default) | |
| EXPOSE 7860 | |
| # Copy configuration file and set user/password | |
| #COPY config/index.js /app/config/index.js | |
| # Set environment variables (if needed) | |
| ENV NODE_ENV=production | |
| # Run the production build | |
| RUN npm run client:build | |
| # Command to run the server using pm2 | |
| CMD ["pm2", "start", "server/app.js"] |