36 lines
1.3 KiB
Docker
36 lines
1.3 KiB
Docker
# Multi-stage build для Ordinis Integrator Guide.
|
|
# Stage 1: build HTML через @diplodoc/cli (yfm).
|
|
# Stage 2: nginx serving static files на /docs/ path.
|
|
|
|
ARG NODE_IMAGE=repo.nstart.cloud/library/node:20-alpine
|
|
ARG NGINX_IMAGE=repo.nstart.cloud/library/nginx:1.27-alpine
|
|
|
|
# ─── Stage 1: Build HTML ─────────────────────
|
|
FROM ${NODE_IMAGE} AS builder
|
|
WORKDIR /docs
|
|
|
|
# Layered cache: package.json + lockfile меняются реже чем content.
|
|
COPY package.json pnpm-lock.yaml ./
|
|
# npm install pnpm — corepack может hang в CI на integrity check / TTY prompts.
|
|
RUN npm install -g --silent pnpm@9.15.4 \
|
|
&& pnpm install --frozen-lockfile
|
|
|
|
# Copy остальное (toc, .yfm, markdown + content directories).
|
|
COPY .yfm toc.yaml index.md changelog.md ./
|
|
COPY integration ./integration
|
|
COPY operator ./operator
|
|
COPY reviewer ./reviewer
|
|
|
|
RUN pnpm build
|
|
|
|
# ─── Stage 2: nginx ──────────────────────────
|
|
FROM ${NGINX_IMAGE}
|
|
COPY --from=builder /docs/_dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Healthcheck для k8s readiness/liveness.
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget -q -O - http://localhost:8080/healthz || exit 1
|
|
|
|
EXPOSE 8080
|