From 917c5eb600a8212bb8c44dc9efac1a001d17c7dd Mon Sep 17 00:00:00 2001 From: Kevin Griffin Date: Fri, 10 Jul 2026 16:25:19 -0700 Subject: [PATCH] Dockerfile: fix permissions Binds entry shadowing /app * Bind only the logs directory instead of mounting over /app: Docker creates the host dir empty on first install, hiding the application code and crash-looping the extension ('Could not find a Litestar app or factory'). $IMAGE_NAME was also never substituted, since Docker does not expand variables in single-quoted LABEL values. * Set WORKDIR /app and pass --app main:app so app discovery no longer depends on the container's default working directory. * Resolve the static files directory relative to main.py instead of the working directory. Fixes #5 Co-Authored-By: Claude Fable 5 --- Dockerfile | 8 +++++--- app/main.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd53494..fddba72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,11 @@ FROM python:3.11-slim COPY app /app RUN python -m pip install /app --extra-index-url https://www.piwheels.org/simple +WORKDIR /app + EXPOSE 8000/tcp -LABEL version="0.0.3" +LABEL version="0.0.4" ARG IMAGE_NAME @@ -15,7 +17,7 @@ LABEL permissions='\ "8000/tcp": {}\ },\ "HostConfig": {\ - "Binds":["/usr/blueos/extensions/$IMAGE_NAME:/app"],\ + "Binds":["/usr/blueos/extensions/quickstart/logs:/app/logs"],\ "ExtraHosts": ["host.docker.internal:host-gateway"],\ "PortBindings": {\ "8000/tcp": [\ @@ -52,4 +54,4 @@ LABEL links='{\ }' LABEL requirements="core >= 1.1" -ENTRYPOINT litestar run --host 0.0.0.0 +ENTRYPOINT litestar --app main:app run --host 0.0.0.0 diff --git a/app/main.py b/app/main.py index 40bdd33..a317337 100644 --- a/app/main.py +++ b/app/main.py @@ -52,7 +52,7 @@ def increment_persistent_count(self, state: State) -> dict[str, int]: route_handlers=[CountController], state=State({'bag_url':'http://host.docker.internal/bag/v1.0'}), static_files_config=[ - StaticFilesConfig(directories=['app/static'], path='/', html_mode=True) + StaticFilesConfig(directories=[Path(__file__).parent / 'static'], path='/', html_mode=True) ], logging_config=logging_config, )