-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
43 lines (27 loc) · 1016 Bytes
/
Dockerfile
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
FROM docker.io/node:22-alpine as base
# Build image (run from root)
FROM base as builder
ARG DEPLOY_ENV
ENV DEPLOY_ENV=${DEPLOY_ENV}
RUN apk add --no-cache libc6-compat zip
WORKDIR /build
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml nx.json ./
COPY apps/ ./apps
COPY packages/ ./packages
COPY tokens/ ./tokens
ENV NEXT_EXPORT=true
RUN corepack enable pnpm
RUN pnpm install --frozen-lockfile
RUN pnpm build
# Production image
FROM ghcr.io/nginxinc/nginx-unprivileged:1.26.1-bookworm-perl
# Copy static assets from builder stage
COPY --from=builder --chown=nginx /build/apps/docs/out /usr/share/nginx/html/doc
COPY --from=builder --chown=nginx /build/packages/react/storybook/storybook-static /usr/share/nginx/html/storybook-react
COPY --from=builder --chown=nginx /build/packages/html/storybook/storybook-static /usr/share/nginx/html/storybook-html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
USER nginx
EXPOSE 8080
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]