-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (29 loc) · 813 Bytes
/
Copy pathDockerfile
File metadata and controls
41 lines (29 loc) · 813 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
36
37
38
39
40
41
FROM node:20-alpine AS builder
ARG NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN
# Set working directory
WORKDIR /app
# Copy package files and install dependencies
COPY ./package*.json ./
RUN npm install
# Copy the rest of the app
COPY . .
RUN npx prisma generate
# Build the Next.js app
RUN npm run build
# Stage 2: Run the app
FROM node:20-alpine AS runner
# Set working directory
WORKDIR /app
# Install only production dependencies
COPY --from=builder /app/package*.json ./
RUN npm install --omit=dev
# Copy built app from builder
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/tsconfig.json ./
# Expose port
EXPOSE 3000
# Start the app
CMD ["npm", "start"]