Added Docker building
parent
6934926136
commit
32a0357c4c
@ -1,8 +1,8 @@
|
||||
**
|
||||
|
||||
!next.config.js
|
||||
!tsconfig.json
|
||||
!package.json
|
||||
!yarn.lock
|
||||
!public
|
||||
!src
|
||||
!/next.config.js
|
||||
!/tsconfig.json
|
||||
!/package.json
|
||||
!/yarn.lock
|
||||
!/public
|
||||
!/src
|
@ -1,32 +1,26 @@
|
||||
FROM node:alpine AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
|
||||
FROM node:alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
ENV NEXT_TELEMETRY_DISABLED 1;
|
||||
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline
|
||||
|
||||
FROM node:alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV production
|
||||
ENV NEXT_TELEMETRY_DISABLED 1;
|
||||
|
||||
RUN addgroup -g 1001 -S nodejs
|
||||
RUN adduser -S nextjs -u 1001
|
||||
RUN yarn export
|
||||
|
||||
COPY --from=builder /app/next.config.js ./
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
|
||||
USER nextjs
|
||||
FROM nginx AS runner
|
||||
|
||||
EXPOSE 3000
|
||||
COPY --from=builder /app/out /usr/share/nginx/html
|
||||
|
||||
CMD ["yarn", "start"]
|
||||
EXPOSE 80
|
Loading…
Reference in new issue