11# syntax=docker/dockerfile:1
2-
3- # Stage 1: Install markdownlint-cli2
4- FROM node:alpine AS linter-builder
5- RUN npm install -g markdownlint-cli2
6-
7- # Stage 2: Final Image
82FROM python:3.12-alpine
93
4+ RUN apk add --no-cache bash git ca-certificates
105
11- # 1. Install runtime essentials and Node.js (for linter)
12- # git is needed for mkdocs-git plugins and git-auto-commit actions.
13- # bash is needed for the entrypoint scripts.
14- # ca-certificates is needed for HTTPS requests (pip, mkdocs etc).
15- RUN apk add --no-cache \
16- bash \
17- git \
18- nodejs \
19- ca-certificates
6+ COPY --from=davidanson/markdownlint-cli2:latest /usr/local/bin/markdownlint-cli2 /usr/local/bin/markdownlint-cli2
207
21- # 2. Copy markdownlint-cli2 from builder and create a slim shim
22- COPY --from=linter-builder /usr/local/lib/node_modules/markdownlint-cli2 /usr/local/lib/node_modules/markdownlint-cli2
23- RUN printf '#!/bin/sh\n node /usr/local/lib/node_modules/markdownlint-cli2/markdownlint-cli2.js "$@"' > /usr/local/bin/markdownlint-cli2 && \
24- chmod +x /usr/local/bin/markdownlint-cli2
25-
26- # 3. Install Python dependencies and clean up cache in one layer
278WORKDIR /app
9+
2810COPY requirements.txt .
29- RUN pip install --no-cache-dir -r requirements.txt
3011COPY .markdownlint.json .
3112
32- # 4. Copy scripts and build script
13+ RUN pip install --no-cache-dir -r requirements.txt
14+
3315COPY scripts/ /app/scripts/
34- COPY --chmod=755 mkdocs-build.sh /usr/local/bin/mkdocs-build
35- COPY --chmod=755 mkdocs-serve.sh /usr/local/bin/mkdocs-serve
36- COPY --chmod=755 zensical-serve.sh /usr/local/bin/zensical-serve
16+ COPY bin/ /usr/local/bin/
17+ RUN for f in /usr/local/bin/*.sh; do mv "$f" "${f%.sh}" ; done && chmod +x /usr/local/bin/*
3718
38- # Set default command
3919CMD ["/usr/local/bin/mkdocs-build" ]
0 commit comments