-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.admin
More file actions
73 lines (53 loc) · 2.19 KB
/
Dockerfile.admin
File metadata and controls
73 lines (53 loc) · 2.19 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
70
71
72
73
# CI/CD build — used by .github/workflows/docker-publish.yml
# Janua Admin - Multi-stage Dockerfile for Next.js
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)
# Note: apps/api is Python, no package.json
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 admin source code BEFORE install
COPY apps/admin/ ./apps/admin/
# 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
RUN pnpm --filter @janua/feature-flags build || true
RUN pnpm --filter @janua/typescript-sdk build || true
RUN pnpm --filter @janua/react-sdk build || true
RUN pnpm --filter @janua/ui build || true
# Build admin with production API URL baked in
# NEXT_PUBLIC_* vars must be set at BUILD time for client-side code
ARG NEXT_PUBLIC_API_URL=https://api.janua.dev
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm --filter admin 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/admin/.next/standalone ./
COPY --from=builder /app/apps/admin/.next/static ./apps/admin/.next/static
COPY --from=builder /app/apps/admin/public ./apps/admin/public
USER nextjs
EXPOSE 3000
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "apps/admin/server.js"]