File size: 750 Bytes
7ec743e
f7dc5bc
 
7ec743e
f7dc5bc
 
ae01397
 
7b65245
ae01397
 
7ec743e
 
66afcc2
 
7ec743e
66afcc2
 
 
 
 
ae01397
66afcc2
f7dc5bc
7ec743e
ae01397
7ec743e
 
f7dc5bc
 
7ec743e
ae01397
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
# Use the official Node.js image as a base
FROM node:20

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json into the container
COPY package.json package-lock.json ./

# Install dependencies using npm (use --legacy-peer-deps if you face dependency issues)
RUN npm install --legacy-peer-deps --unsafe-perm=true

# Create a non-root user and set permissions
RUN useradd -m appuser

# Ensure the /app directory is owned by the non-root user
RUN chown -R appuser /app

# Switch to the non-root user
USER appuser

# Copy the rest of your application code into the container
COPY . .

# Build the Next.js app
RUN npm run build

# Expose the port the app will run on
EXPOSE 3000

# Start the Next.js app
CMD ["npm", "start"]