Fix docs root showing Caddy default page, fix MCP healthcheck

- Clear /usr/share/caddy/* before copying build output to remove
  the default "Caddy works!" index.html from the base image
- Add root redirect: / -> /getting-started/ (permanent)
- Fix try_files to use {path}/index.html for Starlight directories
- Switch MCP healthcheck to TCP socket (GET /mcp returns 406
  without proper Accept headers)
This commit is contained in:
Ryan Malloy 2026-02-23 05:44:58 -07:00
parent 962ee2e0e0
commit 9d25f5efe3
3 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,7 @@ COPY src/ src/
EXPOSE 8000 EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/mcp')" || exit 1 CMD python -c "import socket; s=socket.create_connection(('127.0.0.1',8000),timeout=3); s.close()" || exit 1
USER nobody USER nobody
CMD ["mcnoaa-tides"] CMD ["mcnoaa-tides"]

View File

@ -1,9 +1,11 @@
:4321 { :4321 {
encode gzip encode gzip
redir / /getting-started/ permanent
handle { handle {
root * /usr/share/caddy root * /usr/share/caddy
try_files {path} {path}/ /index.html try_files {path} {path}/index.html
file_server file_server
} }
} }

View File

@ -21,6 +21,7 @@ RUN --mount=type=cache,target=/app/.astro \
# --- Prod --- # --- Prod ---
FROM caddy:2-alpine AS prod FROM caddy:2-alpine AS prod
RUN rm -rf /usr/share/caddy/*
COPY --from=build /app/dist /usr/share/caddy COPY --from=build /app/dist /usr/share/caddy
COPY Caddyfile.prod /etc/caddy/Caddyfile COPY Caddyfile.prod /etc/caddy/Caddyfile
EXPOSE 4321 EXPOSE 4321