-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1.07 KB
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
#Disclaimer : This docker script is just a placeholder for this application
# Stage 1: Build the application
FROM node:18-alpine as builder
# Set working directory
WORKDIR /next-app-boilerplate
# Copy package.json and package-lock.json to the working directory
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the application files to the working directory
COPY . .
# Build the application
RUN npm run build
# Stage 2: Create the production image
FROM node:18-alpine as runner
# Set working directory
WORKDIR /next-app-boilerplate
# Copy necessary files from the builder stage
COPY --from=builder /next-app-boilerplate/package.json .
COPY --from=builder /next-app-boilerplate/package-lock.json .
COPY --from=builder /next-app-boilerplate/next.config.mjs ./
COPY --from=builder /next-app-boilerplate/public ./public
COPY --from=builder /next-app-boilerplate/.next/standalone ./
COPY --from=builder /next-app-boilerplate/.next/static ./.next/static
# Expose the port the app runs on
EXPOSE 3000
# Start the application
ENTRYPOINT ["npm", "start"]