-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.docs
More file actions
69 lines (49 loc) · 1.95 KB
/
Dockerfile.docs
File metadata and controls
69 lines (49 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# CI/CD build — used by .github/workflows/docker-publish.yml
# Janua Docs - Multi-stage Dockerfile for Next.js with MDX
FROM node:20-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache libc6-compat
# Install pnpm
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
# Copy workspace config and all package.json files first
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./
# Copy ALL apps package.json files (needed for workspace resolution)
COPY apps/admin/package.json ./apps/admin/
COPY apps/dashboard/package.json ./apps/dashboard/
COPY apps/docs/package.json ./apps/docs/
COPY apps/edge-verify/package.json ./apps/edge-verify/
COPY apps/website/package.json ./apps/website/
# Copy all packages (needed for workspace)
COPY packages/ ./packages/
# Copy docs source code BEFORE install
COPY apps/docs/ ./apps/docs/
# Inject NPM token for npm.madfam.io private registry auth
ARG NPM_MADFAM_TOKEN
# Copy .npmrc for npm.madfam.io registry configuration
# Workspace packages are resolved locally, published @janua/* from npm.madfam.io
COPY .npmrc ./
# Install dependencies with workspace package linking
RUN pnpm install --no-frozen-lockfile --shamefully-hoist
# Build workspace packages first (docs depends on @janua/ui)
RUN pnpm --filter @janua/ui build || true
# Build docs
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm --filter @janua/docs build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
COPY --from=builder /app/apps/docs/.next/standalone ./
COPY --from=builder /app/apps/docs/.next/static ./apps/docs/.next/static
# Public directory - create empty if not exists
RUN mkdir -p ./apps/docs/public
# Copy content directory for MDX
COPY --from=builder /app/apps/docs/content ./apps/docs/content
USER nextjs
EXPOSE 3000
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "apps/docs/server.js"]