File size: 715 Bytes
7e33654
542406e
efead7f
7e33654
 
c95a2c9
7e33654
efead7f
 
7e33654
efead7f
7e33654
e54ecd7
7e33654
 
 
 
efead7f
 
7e33654
 
 
 
 
 
 
 
c95a2c9
7e33654
 
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
# Use Node.js 18 base image
FROM node:20

# Create a non-root user
RUN groupadd -r appuser && useradd -r -g appuser appuser

# Set working directory
WORKDIR /usr/src/app

# Copy package files and install dependencies
COPY package*.json ./
RUN npm install
RUN npm install express axios cheerio cors
# If building for production, use:
# RUN npm ci --only=production

# Copy application source code
COPY . .

# Change ownership of the app directory to the non-root user
RUN chown -R appuser:appuser /usr/src/app

# Switch to the non-root user
USER appuser

# Expose the desired port (optional, based on your server.js configuration)
EXPOSE 3000

# Set the default command to start the server
CMD ["node", "server.js"]