build: add NOINDEX argument for libghostty-vt docs

pull/8907/merge
Mitchell Hashimoto 2025-09-29 08:46:05 -07:00
parent 3a95920edf
commit 904e09a1da
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 34 additions and 1 deletions

View File

@ -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"]