- 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)
28 lines
667 B
Docker
28 lines
667 B
Docker
# --- Dependencies ---
|
|
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS deps
|
|
WORKDIR /app
|
|
|
|
COPY pyproject.toml uv.lock README.md ./
|
|
COPY src/ src/
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-dev --no-editable
|
|
|
|
# --- Runtime ---
|
|
FROM python:3.12-slim-bookworm AS runtime
|
|
WORKDIR /app
|
|
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
COPY --from=deps /app/.venv /app/.venv
|
|
COPY src/ src/
|
|
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD python -c "import socket; s=socket.create_connection(('127.0.0.1',8000),timeout=3); s.close()" || exit 1
|
|
|
|
USER nobody
|
|
CMD ["mcnoaa-tides"]
|