-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (28 loc) · 936 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
# Stage 1: Build
FROM node:22-alpine as builder
WORKDIR /my-space
# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the application code
COPY . .
# Generate Prisma client
RUN npx prisma generate
# Build the application
RUN npm run build
# Stage 2: Runner
FROM node:22-alpine as runner
WORKDIR /my-space
# Copy necessary files and directories from the builder stage
COPY --from=builder /my-space/package.json .
COPY --from=builder /my-space/package-lock.json .
COPY --from=builder /my-space/next.config.mjs ./
COPY --from=builder /my-space/prisma ./prisma
COPY --from=builder /my-space/node_modules ./node_modules
COPY --from=builder /my-space/public ./public
COPY --from=builder /my-space/.next/standalone ./
COPY --from=builder /my-space/.next/static ./.next/static
# Expose the application port
EXPOSE 3000
# Start the application
ENTRYPOINT ["npm", "start"]