Skip to content

Commit 466ccca

Browse files
Move docs to main site
1 parent a6c77a3 commit 466ccca

File tree

5 files changed

+19
-59
lines changed

5 files changed

+19
-59
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Test
22

33
on:
44
pull_request:
5-
push:
6-
branches:
7-
- main
85

96
jobs:
107
test:

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
# Build docs
2+
FROM node:22-slim AS docs-builder
3+
WORKDIR /docs
4+
COPY docs/package.json docs/bun.lock ./
5+
RUN npm install
6+
COPY docs/ ./
7+
RUN npm run build
8+
9+
# Build API
110
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
211

312
WORKDIR /app
413

514
# Copy project files
615
COPY pyproject.toml README.md ./
716
COPY src/ ./src/
17+
COPY --from=docs-builder /docs/out ./docs/out/
818

919
# Install dependencies
1020
RUN uv pip install --system -e .

docs/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
output: "export",
5-
basePath: "/policyengine-api-v2-alpha",
5+
basePath: "/docs",
66
images: {
77
unoptimized: true,
88
},

src/policyengine_api/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from contextlib import asynccontextmanager
2+
from pathlib import Path
23

34
import logfire
45
from fastapi import FastAPI
56
from fastapi.middleware.cors import CORSMiddleware
7+
from fastapi.staticfiles import StaticFiles
68
from fastapi_cache import FastAPICache
79
from fastapi_cache.backends.inmemory import InMemoryBackend
810
from fastapi_mcp import FastApiMCP
@@ -45,6 +47,7 @@ async def lifespan(app: FastAPI):
4547
debug=settings.debug,
4648
lifespan=lifespan,
4749
redirect_slashes=True,
50+
docs_url=None, # Disable default Swagger UI - we serve custom docs
4851
)
4952

5053
# Add CORS middleware
@@ -66,6 +69,11 @@ async def lifespan(app: FastAPI):
6669
mcp = FastApiMCP(app)
6770
mcp.mount_http()
6871

72+
# Mount static docs site at /docs (built from Next.js in docs/out)
73+
docs_path = Path(__file__).parent.parent.parent / "docs" / "out"
74+
if docs_path.exists():
75+
app.mount("/docs", StaticFiles(directory=docs_path, html=True), name="docs")
76+
6977

7078
@app.get("/health")
7179
def health_check():

0 commit comments

Comments
 (0)