From 904e09a1daa0caa04f05e7cf0de733cc7b0661f1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 29 Sep 2025 08:46:05 -0700 Subject: [PATCH] build: add NOINDEX argument for libghostty-vt docs --- src/build/docker/lib-c-docs/Dockerfile | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/build/docker/lib-c-docs/Dockerfile b/src/build/docker/lib-c-docs/Dockerfile index ce9f3e4c0..782e99994 100644 --- a/src/build/docker/lib-c-docs/Dockerfile +++ b/src/build/docker/lib-c-docs/Dockerfile @@ -2,6 +2,9 @@ # Generate documentation with Doxygen #-------------------------------------------------------------------- FROM ubuntu:24.04 AS builder + +# Build argument for noindex header +ARG ADD_NOINDEX_HEADER=false RUN apt-get update && apt-get install -y \ doxygen \ graphviz \ @@ -16,6 +19,36 @@ RUN doxygen # Host the static HTML #-------------------------------------------------------------------- FROM nginx:alpine AS runtime + +# Pass build arg to runtime stage +ARG ADD_NOINDEX_HEADER=false +ENV ADD_NOINDEX_HEADER=$ADD_NOINDEX_HEADER + +# Copy documentation COPY --from=builder /ghostty/zig-out/share/ghostty/doc/libghostty /usr/share/nginx/html + +# Create entrypoint script +RUN cat > /entrypoint.sh << 'EOF' +#!/bin/sh +if [ "$ADD_NOINDEX_HEADER" = "true" ]; then + cat > /etc/nginx/conf.d/noindex.conf << 'INNER_EOF' +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html; + add_header X-Robots-Tag "noindex, nofollow" always; + } +} +INNER_EOF + + # Remove default server config + rm -f /etc/nginx/conf.d/default.conf +fi +exec nginx -g "daemon off;" +EOF + +RUN chmod +x /entrypoint.sh + EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] +CMD ["/entrypoint.sh"]