-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathDockerfileColorPaletteGenerator
More file actions
62 lines (47 loc) · 2.22 KB
/
DockerfileColorPaletteGenerator
File metadata and controls
62 lines (47 loc) · 2.22 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
# 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 Color Palette Generator"
LABEL org.opencontainers.image.description="Equinor Design System Color Palette Generator"
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, 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-color-palette-generator 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-color-palette-generator/package.json ./apps/eds-color-palette-generator/
COPY --chown="$USER":"$USER" packages/eds-tokens/package.json ./packages/eds-tokens/
COPY --chown="$USER":"$USER" packages/eds-utils/package.json ./packages/eds-utils/
# Install only production dependencies
RUN pnpm install --prod --frozen-lockfile
# Copy built files
COPY --chown="$USER":"$USER" --from=build /app/apps/eds-color-palette-generator/.next ./apps/eds-color-palette-generator/.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-tailwind/theme.css ./packages/eds-tailwind/theme.css
COPY --chown="$USER":"$USER" --from=build /app/packages/eds-utils/dist ./packages/eds-utils/dist
USER "$UID"
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--"]
WORKDIR /app/apps/eds-color-palette-generator
CMD ["pnpm", "start"]