Dockerfile940 bytes written ▸text42 lines · 940 chars
# Multi-stage Dockerfile for Nuxt monorepo with PNPM
FROM node:lts-bookworm AS builder
WORKDIR /workspace
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential git ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Install exact PNPM version
RUN npm install -g pnpm@10.32.1
# Copy the repository
COPY . .
# Install dependencies
RUN pnpm install --frozen-lockfile
# Build the project
RUN pnpm build
# Runtime stage
FROM node:lts-bookworm
WORKDIR /workspace
ENV NODE_ENV=production
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder
COPY --from=builder /workspace/packages /workspace/packages
# Expose Nuxt port
EXPOSE 3000
# Start the production server
CMD ["node", "packages/nuxt/bin/nuxt.mjs", "start"]