-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (34 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (34 loc) · 1.54 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
# syntax=docker/dockerfile:1
# NOTE: This image intentionally runs `pnpm run build` at container startup so
# environment variables provided at `docker run` time (e.g. `--env-file`) are
# available during the Docusaurus build.
FROM node:24-bookworm-slim AS deps
WORKDIR /repo
# Use Corepack so the pnpm version is managed by Node.
ENV PNPM_HOME=/pnpm
ENV PATH=$PNPM_HOME:$PATH
RUN corepack enable
# This Dockerfile must be built with the repository root as the build context, e.g.:
# docker build -f Dockerfile -t docusaurus-site:latest .
# because the Docusaurus site depends on workspace packages in /packages.
# Copy workspace + package manifests first for better layer caching.
COPY pnpm-workspace.yaml pnpm-lock.yaml ./
COPY docusaurus/package.json ./docusaurus/package.json
COPY packages/docusaurus-plugin-reactor-docgen/package.json ./packages/docusaurus-plugin-reactor-docgen/package.json
COPY packages/docusaurus-theme-reactor-docgen/package.json ./packages/docusaurus-theme-reactor-docgen/package.json
# Install all workspace dependencies (root has no package.json, so we use recursive mode).
RUN pnpm -r install --frozen-lockfile
# Bring in the rest of the sources (but do NOT build here).
COPY . .
FROM node:24-bookworm-slim AS runtime
WORKDIR /repo
ENV PNPM_HOME=/pnpm
ENV PATH=$PNPM_HOME:$PATH
RUN corepack enable
COPY --from=deps /repo /repo
WORKDIR /repo/docusaurus
ENV PORT=3000
# Normalize CRLF in case this repo was checked out on Windows.
RUN sed -i 's/\r$//' ./docker-entrypoint.sh
EXPOSE 3000
CMD ["sh", "./docker-entrypoint.sh"]