File size: 950 Bytes
d823cdc
 
 
74d4fd2
 
 
 
d823cdc
 
 
3e238cf
 
 
d823cdc
 
 
 
 
 
74d4fd2
 
 
37fe4aa
74d4fd2
 
005ca8a
083649c
 
 
 
 
d823cdc
74d4fd2
d823cdc
74d4fd2
 
083649c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use Node.js 18 base image
FROM node:18

# Set environment variables for user and password
ENV USER=myuser
ENV PASSWORD=mypassword

# Set the working directory inside the container
WORKDIR /app

# Create a non-root user to run the application
RUN useradd --create-home --shell /bin/bash appuser

# Clone the repository
RUN git clone https://github.com/ChrisCindy/node-web-console.git .

# Install dependencies
RUN npm install

# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/

# Change permissions of the entrypoint script (before switching users)
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

# Ensure the non-root user has full access to the entire /app directory
RUN chown -R appuser:appuser /app

# Switch to the non-root user
USER appuser

# Expose the port the app runs on
EXPOSE 3000

# Run the entrypoint script and start the web server in production mode
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["npm", "run", "prod"]