Skip to content

Commit 2cba2e6

Browse files
committed
upd: resolved Dockerfile.docs build issues
1 parent 6e92b8c commit 2cba2e6

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

Dockerfile.docs

+8-28
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,43 @@
11
# syntax=docker/dockerfile:1
22

3-
## Modified version of https://docusaurus.community/knowledge/deployment/docker/
4-
53
# Stage 1: Base image.
64
## Start with a base image containing NodeJS so we can build Docusaurus.
75
FROM node:23.3.0-slim AS base
86
## Disable colour output from yarn to make logs easier to read.
9-
10-
## https://pnpm.io/docker
11-
ENV PNPM_HOME="/pnpm"
12-
ENV PATH="$PNPM_HOME:$PATH"
13-
147
ENV FORCE_COLOR=0
158
## Enable corepack.
169
RUN corepack enable
1710
## Set the working directory to `/opt/docusaurus`.
1811
WORKDIR /opt/docusaurus
1912

20-
## Required by docusaurus: [ERROR] Loading of version failed for version current
21-
RUN apt-get update && apt-get install -y git
22-
13+
# Stage 2a: Development mode.
2314
FROM base AS dev
2415
## Set the working directory to `/opt/docusaurus`.
2516
WORKDIR /opt/docusaurus
2617
## Expose the port that Docusaurus will run on.
2718
EXPOSE 3000
2819
## Run the development server.
29-
CMD [ -d "node_modules" ] && npm run start -- --host 0.0.0.0 --poll 1000 || pnpm install && pnpm run start -- --host 0.0.0.0 --poll 1000
20+
CMD [ -d "node_modules" ] && pnpm start -- --host 0.0.0.0 --poll 1000 || pnpm install && pnpm start -- --host 0.0.0.0 --poll 1000
3021

3122
# Stage 2b: Production build mode.
32-
FROM base AS preprod
23+
FROM base AS prod
3324
## Set the working directory to `/opt/docusaurus`.
3425
WORKDIR /opt/docusaurus
3526

36-
## This is in case someone needs to build the lock file
37-
#RUN apt install python-is-python3 g++ make -y
38-
39-
COPY docs/package.json /opt/docusaurus/package.json
40-
COPY docs/package-lock.json /opt/docusaurus/package-lock.json
41-
42-
FROM preprod AS prod
43-
44-
## Install dependencies with `--immutable` to ensure reproducibility.
45-
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
46-
47-
## Copy over the source code.
4827
COPY docs/ /opt/docusaurus/
4928
COPY packages/ /opt/packages/
5029

5130
## Required buy docusaurus [ERROR] Loading of version failed for version current
5231
COPY .git/ /opt/.git/
5332

54-
# Build from sources
55-
RUN pnpm run build
33+
## Install dependencies with `--frozen-lockfile` to ensure reproducibility.
34+
RUN pnpm install --no-frozen-lockfile
35+
## Build the static site.
36+
RUN pnpm build
5637

5738
# Stage 3a: Serve with `docusaurus serve`.
5839
FROM prod AS serve
5940
## Expose the port that Docusaurus will run on.
6041
EXPOSE 3000
6142
## Run the production server.
62-
CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"]
63-
43+
CMD ["pnpm", "run", "serve", "--host", "0.0.0.0", "--no-open"]

0 commit comments

Comments
 (0)