-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathDockerfileEdsDemo
More file actions
63 lines (48 loc) · 2.12 KB
/
DockerfileEdsDemo
File metadata and controls
63 lines (48 loc) · 2.12 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
# Use Node.js 22.12 with Alpine - allows patch updates while maintaining reproducibility
FROM docker.io/node:22.12-alpine AS build
LABEL org.opencontainers.image.title="EDS Demo Application"
LABEL org.opencontainers.image.description="Equinor Design System Demo Application"
LABEL org.opencontainers.image.source="https://github.com/equinor/design-system"
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm@10.15.0
# Copy everything
COPY . ./
# Install dependencies first
RUN pnpm install --frozen-lockfile
# Build workspace dependencies in correct order, then build the app
RUN pnpm --filter @equinor/eds-tokens-sync run build && \
pnpm --filter @equinor/eds-tokens-build run build && \
pnpm --filter @equinor/eds-tokens run build && \
pnpm --filter @equinor/eds-utils run build && \
pnpm --filter @equinor/eds-icons run build && \
pnpm --filter @equinor/eds-core-react run build && \
pnpm --filter eds-demo run build
FROM node:22.12-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production \
PORT=3000 \
USER=nextjs \
UID=12345 \
NEXT_TELEMETRY_DISABLED=1
# Install pnpm and create non-root user
RUN npm install -g pnpm@10.15.0 && \
addgroup -S "$USER" && \
adduser -S --uid "$UID" "$USER" && \
apk add --no-cache tini
# Copy package files for production install
COPY --chown="$USER":"$USER" package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY --chown="$USER":"$USER" apps/eds-demo/package.json ./apps/eds-demo/
COPY --chown="$USER":"$USER" packages/eds-tokens/package.json ./packages/eds-tokens/
COPY --chown="$USER":"$USER" packages/eds-core-react/package.json ./packages/eds-core-react/
# Install only production dependencies
RUN pnpm install --prod --frozen-lockfile
# Copy built files
COPY --chown="$USER":"$USER" --from=build /app/apps/eds-demo/.next ./apps/eds-demo/.next
COPY --chown="$USER":"$USER" --from=build /app/packages/eds-tokens/dist ./packages/eds-tokens/dist
COPY --chown="$USER":"$USER" --from=build /app/packages/eds-core-react/dist ./packages/eds-core-react/dist
USER "$UID"
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--"]
WORKDIR /app/apps/eds-demo
CMD ["pnpm", "start"]