# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm
COPY services/content/package.json services/content/pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY services/content/tsconfig.json services/content/nest-cli.json ./
COPY services/content/src ./src
RUN pnpm build

# Runtime stage
FROM node:20-alpine
WORKDIR /app
RUN npm install -g pnpm
COPY services/content/package.json services/content/pnpm-lock.yaml* ./
RUN pnpm install --prod --frozen-lockfile
COPY --from=builder /app/dist ./dist
COPY packages/shared-proto/proto/content.proto ./proto/content.proto
EXPOSE 3005 50054
CMD ["node", "dist/main.js"]
