-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-static
37 lines (27 loc) · 1.13 KB
/
Dockerfile-static
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
# Install dependencies only when needed
FROM node:lts-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# If using npm with a `package-lock.json` comment out above and use below instead
# COPY package.json package-lock.json ./
# RUN npm ci
# Rebuild the source code only when needed
FROM node:lts-alpine AS builder
ENV NODE_ENV production
COPY --from=deps node_modules node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn export
# If using npm comment out above and use below instead
# RUN npm run build
# Production image, copy all the files and run next
FROM nginx:stable-alpine AS runner
WORKDIR /usr/local/nginx
COPY --from=builder out /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]