-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 650 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 650 Bytes
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
# Stage 1: Building the code
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Run the application
FROM node:18-alpine AS runner
WORKDIR /app
# Set to production environment
ENV NODE_ENV=production
# Copy necessary files from builder
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# Expose the port the app runs on
EXPOSE 3000
# Command to run the application
CMD ["node", "server.js"]