File size: 647 Bytes
b34944a
 
 
 
 
fa9b005
b34944a
 
 
 
 
 
 
 
 
 
 
fa9b005
b34944a
 
 
 
 
1e5cd1d
b34944a
 
 
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
# Use Node.js LTS (Buster) as the base image
FROM node:lts-buster


# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json (or yarn.lock if using yarn)
COPY package*.json ./

# Install dependencies (try npm first, fall back to yarn)
RUN npm install || yarn install

# Copy the rest of your app files to the container
COPY . .

# Change ownership of the application files to the 'node' user
RUN chown -R node:node /app

# Switch to the 'node' user for security reasons
USER node

# Expose the port (assuming the app runs on port 8000)
EXPOSE 8000

# Start the app using `npm start`
CMD ["npm", "start"]