| # Use the official Node.js 18 image as the base image | |
| FROM node:18 | |
| # Clone the repository into the current directory | |
| RUN git clone https://github.com/Niansuh/uptime.git | |
| # Set the working directory to the directory | |
| WORKDIR "uptime" | |
| # Install dependencies using npm | |
| RUN npm install | |
| # Build the project | |
| RUN npm run build | |
| # Create the data directory with proper permissions | |
| RUN mkdir -p ./data && chown -R node:node ./data | |
| # Expose port 3001 for the application | |
| EXPOSE 3001 | |
| # Switch to the 'node' user | |
| USER node | |
| # Command to start the application when the container starts | |
| CMD ["node", "server/server.js"] |