Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9fabe16

Browse files
Update Dockerfile
1 parent 1c89646 commit 9fabe16

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

‎Dockerfile

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
# Get NPM packages
2-
FROM node:14-alpine AS dependencies
2+
FROM node:14-alpine AS builder
33
RUN apk add --no-cache libc6-compat
4-
WORKDIR /app
5-
COPY package.json package-lock.json ./
6-
RUN npm ci --only=production
74

8-
# Rebuild the source code only when needed
9-
FROM node:14-alpine AS builder
105
WORKDIR /app
6+
COPY package.json package-lock.json ./
117
COPY . .
12-
COPY --from=dependencies /app/node_modules ./node_modules
13-
RUN npm run build
8+
9+
RUN npm ci --only=production && npm run build
1410

1511
# Production image, copy all the files and run next
1612
FROM node:14-alpine AS runner
1713
WORKDIR /app
18-
1914
ENV NODE_ENV production
2015

21-
RUN addgroup -g 1001 -S nodejs
22-
RUN adduser -S nextjs -u 1001
23-
24-
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
25-
COPY --from=builder /app/node_modules ./node_modules
26-
COPY --from=builder /app/package.json ./package.json
16+
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
17+
COPY --from=builder --chown=nextjs:nodejs /app .
2718

2819
USER nextjs
2920
EXPOSE 3000

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /