Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Node.js 18 image as the base image
|
2 |
+
FROM node:18
|
3 |
+
|
4 |
+
# Clone the repository into the current directory
|
5 |
+
RUN git clone https://github.com/Niansuh/uptime.git
|
6 |
+
|
7 |
+
# Set the working directory to the directory
|
8 |
+
WORKDIR "uptime"
|
9 |
+
|
10 |
+
# Install dependencies using npm
|
11 |
+
RUN npm install
|
12 |
+
|
13 |
+
# Build the project
|
14 |
+
RUN npm run build
|
15 |
+
|
16 |
+
# Create the data directory with proper permissions
|
17 |
+
RUN mkdir -p ./data && chown -R node:node ./data
|
18 |
+
|
19 |
+
# Expose port 3001 for the application
|
20 |
+
EXPOSE 3001
|
21 |
+
|
22 |
+
# Switch to the 'node' user
|
23 |
+
USER node
|
24 |
+
|
25 |
+
# Command to start the application when the container starts
|
26 |
+
CMD ["node", "server/server.js"]
|