Skip to content

Instantly share code, notes, and snippets.

@mqnoy
Created August 9, 2024 23:35
Show Gist options
  • Save mqnoy/c07d5d2a1bfee79afd80861e5bb25d5b to your computer and use it in GitHub Desktop.
Save mqnoy/c07d5d2a1bfee79afd80861e5bb25d5b to your computer and use it in GitHub Desktop.
NextJS 14 SSR + CSR Docker
FROM node:20-alpine AS builder
RUN npm install -g pnpm
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
COPY . .
RUN pnpm run build
FROM node:20-alpine AS runner
RUN npm install -g pnpm
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
EXPOSE 3002
CMD ["pnpm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment