Skip to content

Commit 6178d64

Browse files
committed
add Dockerfile for docs build step
1 parent 7f099af commit 6178d64

2 files changed

Lines changed: 42 additions & 65 deletions

File tree

Dockerfile

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
# Basic docker based environment
2-
# Necessary to trick dokku into building the documentation
3-
# using dockerfile instead of herokuish
4-
FROM ubuntu:22.04
5-
6-
# Add basic tools
7-
RUN apt-get update && \
8-
apt-get install -y build-essential \
9-
software-properties-common \
10-
curl \
11-
git \
12-
libxml2 \
13-
libffi-dev \
14-
libssl-dev && \
15-
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php && \
16-
apt-get update && \
17-
apt-get install -y php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip php8.1-intl php8.1-opcache php8.1-sqlite &&\
18-
apt-get clean &&\
19-
rm -rf /var/lib/apt/lists/*
20-
21-
WORKDIR /code
22-
23-
VOLUME ["/code"]
24-
25-
CMD [ '/bin/bash' ]
1+
# ----------------------
2+
# 1. Build stage
3+
# ----------------------
4+
FROM node:22-alpine AS builder
5+
6+
# Git is required because docs/package.json pulls a dependency from GitHub.
7+
RUN apk add --no-cache git openssh-client
8+
9+
WORKDIR /app/docs
10+
11+
# Copy dependency manifests first to preserve Docker layer caching.
12+
COPY docs/ ./
13+
RUN npm ci
14+
15+
# Increase max-old-space-size to avoid memory issues during build
16+
ENV NODE_OPTIONS="--max-old-space-size=8192"
17+
18+
# Build the site.
19+
RUN npm run docs:build
20+
21+
# ----------------------
22+
# 2. Runtime stage (nginx)
23+
# ----------------------
24+
FROM nginx:1.27-alpine AS runner
25+
26+
# Copy built files
27+
COPY --from=builder /app/docs/.vitepress/dist /usr/share/nginx/html
28+
29+
# Expose port
30+
EXPOSE 80
31+
32+
# Health check (optional)
33+
HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
34+
35+
# Start nginx
36+
CMD ["nginx", "-g", "daemon off;"]

docs/package-lock.json

Lines changed: 6 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)