-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
46 lines (33 loc) · 974 Bytes
/
Dockerfile
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
39
40
41
42
43
44
45
46
# Builder Stage
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml* ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# Build the Next.js application
RUN pnpm build
# Production Stage
FROM node:22-alpine AS runner
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Set node environment to production
ENV NODE_ENV=production
# Copy necessary files from builder stage
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# Copy the startup script
COPY startup.sh /app/startup.sh
# Ensure the startup script is executable
RUN chmod +x /app/startup.sh
# Expose the port the app runs on
EXPOSE 3000
# Define the command to run the startup script
CMD ["/app/startup.sh"]