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 1c89646

Browse files
Added Dockerfile
1 parent 60ef347 commit 1c89646

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Get NPM packages
2+
FROM node:14-alpine AS dependencies
3+
RUN apk add --no-cache libc6-compat
4+
WORKDIR /app
5+
COPY package.json package-lock.json ./
6+
RUN npm ci --only=production
7+
8+
# Rebuild the source code only when needed
9+
FROM node:14-alpine AS builder
10+
WORKDIR /app
11+
COPY . .
12+
COPY --from=dependencies /app/node_modules ./node_modules
13+
RUN npm run build
14+
15+
# Production image, copy all the files and run next
16+
FROM node:14-alpine AS runner
17+
WORKDIR /app
18+
19+
ENV NODE_ENV production
20+
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
27+
28+
USER nextjs
29+
EXPOSE 3000
30+
31+
CMD ["npm", "start"]

0 commit comments

Comments
(0)

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