Skip to content

Commit 3fd633f

Browse files
committed
fix: Resolve frontend dir
Could be in different places depending on how we install chronowarden Assisted-By: Anthropic:claude-opus-4.8
1 parent 5a791e5 commit 3fd633f

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ Join us on [Matrix](https://matrix.to/#/#chronowarden:reszka.org) to discuss and
4444
```bash
4545
docker run --network=host --rm -p 8000:8000 \
4646
-v $(pwd)/config.yaml:/data/config.yaml \
47-
ghcr.io/fajfer/chronowarden:v0.2.0
47+
ghcr.io/fajfer/chronowarden:v0.2.1
4848
```
4949

5050
Add `-v $(pwd)/chronowarden.db:/app/chronowarden.db` if you already have a DB
5151

5252
#### Building image
5353
Production (default) — distroless, no shell, 86MB \
54-
`docker build -t fajfer/chronowarden:0.2.0 .`
54+
`docker build -t fajfer/chronowarden:0.2.1 .`
5555

5656
Development — full shell, git, --reload, 286MB \
57-
`docker build --target dev -t fajfer/chronowarden:0.2.0-dev .`
57+
`docker build --target dev -t fajfer/chronowarden:0.2.1-dev .`
5858

5959
### Prerequisites
6060

chronowarden/app.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,21 @@ async def root() -> dict[str, str]:
110110

111111
# Serve SvelteKit static frontend in production.
112112
# The build directory is created by `npm run build` with adapter-static.
113-
_FRONTEND_DIR = Path(__file__).resolve().parent.parent / "frontend" / "build"
113+
def _resolve_frontend_dir() -> Path:
114+
"""Return the first existing frontend build directory."""
115+
override = os.environ.get("CHRONOWARDEN_FRONTEND_DIR")
116+
candidates = [
117+
Path(override) if override else None,
118+
Path(__file__).resolve().parent.parent / "frontend" / "build",
119+
Path("/app/frontend/build"),
120+
]
121+
for candidate in candidates:
122+
if candidate is not None and candidate.is_dir():
123+
return candidate
124+
return Path("/app/frontend/build")
125+
126+
127+
_FRONTEND_DIR = _resolve_frontend_dir()
114128

115129
if _FRONTEND_DIR.is_dir():
116130

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[project]
66
name = "chronowarden"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
description = "Cloud-native secret expiration monitoring service"
99
readme = "README.md"
1010
requires-python = ">=3.12"

0 commit comments

Comments
 (0)