Skip to content

Commit f20f8f3

Browse files
committed
deploy: ship SPA assets in image and route compose default to SPA
1 parent dde2d28 commit f20f8f3

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
FROM node:22-alpine AS ui-builder
2+
3+
WORKDIR /ui
4+
5+
COPY chronicle-ui/package.json chronicle-ui/package-lock.json ./
6+
RUN npm ci
7+
8+
COPY chronicle-ui/ ./
9+
RUN npm run build
10+
111
FROM python:3.12-slim
212

313
ENV PYTHONDONTWRITEBYTECODE=1 \
@@ -13,6 +23,7 @@ COPY requirements.txt /app/requirements.txt
1323
RUN pip install --no-cache-dir -r /app/requirements.txt
1424

1525
COPY . /app
26+
COPY --from=ui-builder /ui/dist /app/chronicle-ui/dist
1627
RUN mkdir -p /app/state
1728

1829
CMD ["python", "-m", "chronicle.worker"]

chronicle/api_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def sources_page():
877877

878878
@app.get("/")
879879
def landing_page():
880-
return redirect("/dashboard", code=302)
880+
return redirect("/view", code=302)
881881

882882

883883
@app.get("/dashboard")

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ services:
3434
- .env
3535
environment:
3636
- SETUP_ENV_FILE=/app/.env
37+
- UI_ROLLOUT_DEFAULT_MODE=${UI_ROLLOUT_DEFAULT_MODE:-spa}
3738
volumes:
3839
- ./data:/app/state
3940
- ./.env:/app/.env

tests/test_api_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ def test_setup_page_endpoint(self) -> None:
149149
response = self.client.get("/setup")
150150
self.assertEqual(response.status_code, 200)
151151

152-
def test_root_redirects_to_dashboard(self) -> None:
152+
def test_root_redirects_to_view(self) -> None:
153153
response = self.client.get("/", follow_redirects=False)
154154
self.assertEqual(response.status_code, 302)
155-
self.assertEqual(response.headers.get("Location"), "/dashboard")
155+
self.assertEqual(response.headers.get("Location"), "/view")
156156

157157
def test_dashboard_page_endpoint(self) -> None:
158158
response = self.client.get("/dashboard")

0 commit comments

Comments
 (0)