File size: 612 Bytes
28b29f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 20 image.
FROM node:20-alpine

# Set the user to root to install pnpm globally
USER root

# Install pnpm
RUN npm i -g pnpm

# Set a non-root user for security
USER 1000

# Set the working directory
WORKDIR /usr/src/app

# Copy package.json and pnpm-lock.yaml to the container
COPY --chown=1000 package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install

# Copy the rest of the application files to the container
COPY --chown=1000 . .


# Build the Next.js application
RUN pnpm build

# Expose the application port
EXPOSE 3000

# Start the application
CMD ["pnpm", "start"]