-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 902 Bytes
/
Dockerfile
File metadata and controls
43 lines (29 loc) · 902 Bytes
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
# syntax=docker/dockerfile:1
FROM node:22-alpine AS builder
RUN apk update && apk add git python3 make g++ openssl busybox
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy just the package files first for better caching
COPY package.json pnpm-lock.yaml* ./
# Force CI mode which avoids interactive prompts
ENV CI=true
ENV HUSKY=0
# Install dependencies non-interactively
RUN pnpm install --frozen-lockfile
# Now copy the rest of the code
COPY . .
# Build storybook
RUN pnpm build-storybook
# Production image using serve
FROM node:22-alpine AS dist
# Install serve globally
RUN npm install -g serve
USER node
WORKDIR /app
# Copy the storybook-static directory which contains the built storybook
COPY --from=builder /app/storybook-static ./storybook-static
# Expose port for serve
EXPOSE 8080
# Start serve to host the static files
CMD ["serve", "storybook-static", "-l", "8080"]