Update Dockerfile
Browse files- Dockerfile +24 -24
Dockerfile
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
-
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
#
|
| 14 |
-
RUN useradd -rm -d /home/user -s /bin/bash -g root -G sudo -u 1000 user && \
|
| 15 |
-
echo 'user:user' | chpasswd && \
|
| 16 |
-
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
| 17 |
-
|
| 18 |
-
# Allow root login and password authentication
|
| 19 |
-
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
| 20 |
-
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
| 21 |
-
|
| 22 |
-
# Expose SSH port
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Base image: Node.js version 18 (which supports the required Node.js version 7.6.0+)
|
| 2 |
+
FROM node:18
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Clone the Node-Web-Console repository
|
| 8 |
+
RUN git clone https://github.com/ChrisCindy/node-web-console.git .
|
| 9 |
+
|
| 10 |
+
# Install dependencies
|
| 11 |
+
RUN npm install
|
| 12 |
+
|
| 13 |
+
# Expose the port the app will run on (3000 by default)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
EXPOSE 7860
|
| 15 |
|
| 16 |
+
# Copy configuration file and set user/password
|
| 17 |
+
COPY config/index.js /app/config/index.js
|
| 18 |
+
|
| 19 |
+
# Set environment variables (if needed)
|
| 20 |
+
ENV NODE_ENV=production
|
| 21 |
+
|
| 22 |
+
# Run the production build
|
| 23 |
+
RUN npm run client:build
|
| 24 |
+
|
| 25 |
+
# Command to run the server using pm2
|
| 26 |
+
CMD ["npm", "run", "prod"]
|