-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.mkdocs-test
More file actions
40 lines (31 loc) · 1.1 KB
/
Dockerfile.mkdocs-test
File metadata and controls
40 lines (31 loc) · 1.1 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
# Stage 1: Builder - Compile dependencies as wheels
FROM squidfunk/mkdocs-material:9.5 as builder
# Install build tools for compilation (Alpine Linux)
# gcc/g++ needed for mkdocs-with-pdf (libsass compilation)
RUN apk add --no-cache \
gcc \
g++ \
musl-dev \
python3-dev
WORKDIR /build
# Copy requirements and build wheels (cached layer)
# Use requirements-dsfr.txt (contains mkdocs-dsfr + all dependencies)
COPY requirements-dsfr.txt .
RUN pip wheel --no-cache-dir --wheel-dir=/wheels -r requirements-dsfr.txt
# Stage 2: Runtime - Image with pre-compiled wheels + E2E dependencies
FROM squidfunk/mkdocs-material:9.5
WORKDIR /docs
# Install runtime dependencies for E2E tests
# - bash: test scripts
# - git: scenario rollback/checkout
# - curl: scenario HTTP preview
RUN apk add --no-cache \
bash \
git \
curl
# Copy pre-compiled wheels from builder
COPY --from=builder /wheels /wheels
# Install from wheels (fast, no compilation needed)
RUN pip install --no-cache-dir --no-index --find-links=/wheels /wheels/*.whl && \
rm -rf /wheels
CMD ["mkdocs", "serve", "--dev-addr=0.0.0.0:8000"]