Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
NayamAmarshe committed Apr 7, 2023
1 parent 37d5bff commit 2a04fa7
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,28 @@ RUN \

FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/node_modules ./node_modules
COPY . .

COPY --from=deps /app/node_modules ./node_modules
RUN npm run build

# Production image, copy all the files and run next
FROM node:16-alpine AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 maglit
ENV NODE_ENV=production

# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --chown=node --from=builder /app/next.config.js ./
COPY --chown=node --from=builder /app/public ./public
COPY --chown=node --from=builder /app/.next ./.next
COPY --chown=node --from=builder /app/package.json ./package.json
COPY --chown=node --from=builder /app/package-lock.json ./package-lock.json
COPY --chown=node --from=builder /app/node_modules ./node_modules

# Automatically leverage output traces to reduce image size
COPY --from=builder --chown=maglit:nodejs /app/.next/standalone ./
COPY --from=builder --chown=maglit:nodejs /app/.next/static ./.next/static

USER maglit
# COPY --from=builder --chown=maglit:nodejs /app/.next/standalone ./
# COPY --from=builder --chown=maglit:nodejs /app/.next/static ./.next/static

USER node
EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
CMD ["npm run", "start"]

1 comment on commit 2a04fa7

@vercel
Copy link

@vercel vercel bot commented on 2a04fa7 Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.