Created
November 25, 2024 07:08
-
-
Save aybabtme/ac4b4156b8a098ca486832c3bf93fadf to your computer and use it in GitHub Desktop.
Revisions
-
aybabtme created this gist
Nov 25, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ FROM node:22-alpine AS base # deps FROM base AS deps WORKDIR /usr/src/app RUN apk add --no-cache libc6-compat COPY package.json package-lock.json* ./ RUN npm ci # builder FROM base AS builder WORKDIR /usr/src/app COPY --from=deps /usr/src/app/node_modules ./node_modules COPY . . RUN npm run build # server FROM base AS server WORKDIR /usr/src/app ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs COPY --from=builder /usr/src/app/public ./public RUN mkdir .next RUN chown nextjs:nodejs .next COPY --from=builder --chown=nextjs:nodejs /usr/src/app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /usr/src/app/.next/static ./.next/static USER nextjs EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME="0.0.0.0" ENTRYPOINT ["node", "server.js"]