Added Docker building
parent
6934926136
commit
32a0357c4c
@ -1,8 +1,8 @@
|
|||||||
**
|
**
|
||||||
|
|
||||||
!next.config.js
|
!/next.config.js
|
||||||
!tsconfig.json
|
!/tsconfig.json
|
||||||
!package.json
|
!/package.json
|
||||||
!yarn.lock
|
!/yarn.lock
|
||||||
!public
|
!/public
|
||||||
!src
|
!/src
|
@ -1,32 +1,26 @@
|
|||||||
FROM node:alpine AS deps
|
FROM node:alpine AS deps
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock ./
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
FROM node:alpine AS builder
|
FROM node:alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
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 yarn export
|
||||||
RUN adduser -S nextjs -u 1001
|
|
||||||
|
|
||||||
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