build: move entrypoint out to separate file

pull/8907/merge
Mitchell Hashimoto 2025-09-29 08:51:55 -07:00
parent 904e09a1da
commit 16077f0542
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 18 additions and 23 deletions

View File

@ -24,30 +24,9 @@ FROM nginx:alpine AS runtime
ARG ADD_NOINDEX_HEADER=false ARG ADD_NOINDEX_HEADER=false
ENV ADD_NOINDEX_HEADER=$ADD_NOINDEX_HEADER ENV ADD_NOINDEX_HEADER=$ADD_NOINDEX_HEADER
# Copy documentation # Copy documentation and entrypoint script
COPY --from=builder /ghostty/zig-out/share/ghostty/doc/libghostty /usr/share/nginx/html COPY --from=builder /ghostty/zig-out/share/ghostty/doc/libghostty /usr/share/nginx/html
COPY src/build/docker/lib-c-docs/entrypoint.sh /entrypoint.sh
# 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 RUN chmod +x /entrypoint.sh
EXPOSE 80 EXPOSE 80

View File

@ -0,0 +1,16 @@
#!/bin/sh
if [ "$ADD_NOINDEX_HEADER" = "true" ]; then
cat > /etc/nginx/conf.d/noindex.conf << 'EOF'
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
add_header X-Robots-Tag "noindex, nofollow" always;
}
}
EOF
# Remove default server config
rm -f /etc/nginx/conf.d/default.conf
fi
exec nginx -g "daemon off;"