Repository navigation
feat: docker packaging for the Streamlit web app - #62
Merged
Merged
Conversation
- multi-stage Dockerfile: dependency set installed into an isolated venv in the builder stage and copied into a clean python:3.12-slim runtime; unprivileged uid 1000 runtime user; built-in HEALTHCHECK on the streamlit health endpoint; PORT / BASE_URL_PATH overridable via env - docker-compose.yml (compose v2 spec, no version key) with restart: unless-stopped binding 127.0.0.1:8501 — the reverse proxy in front keeps working unchanged; container replaces the ad-hoc nohup process and gains auto-restart across host reboots - the PyPI package stays library-only: the app is packaged from the repository snapshot (SETUPTOOLS_SCM_PRETEND_VERSION pins the version since the build context has no .git) - pip cache mount in the builder stage for fast rebuilds
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #62 +/- ##
=======================================
Coverage 98.61% 98.61%
=======================================
Files 13 13
Lines 1944 1944
=======================================
Hits 1917 1917
Misses 27 27 ☔ View full report in Codecov by Harness. |
kjs11
enabled auto-merge
November 1, 2026 03:48
kjs11
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Containerize the Streamlit web app so it runs as a managed service instead of an ad-hoc
nohupprocess: built-in restart across host reboots, a health check, and a locked, isolated dependency set on top ofpython:3.12-slim(decoupled from the host's site-packages).The PyPI package stays library-only —
streamlit_app.pyis an application, not part of the library, so the image packages it from the repository snapshot (COPY streamlit_app.py) and installs the library from the same tree. Nothing in the packaging configuration changes.What's in the box
Dockerfile(multi-stage, modern BuildKit idioms):appextra into an isolated/opt/venv; the runtime stage copies only the finished venv — no pip, no build tooling;RUN --mount=type=cache,target=/root/.cache/pipkeeps pip downloads across rebuilds (the modern replacement for--no-cache-dir);HEALTHCHECKon/_stcore/health;PORT/BASE_URL_PATHoverridable via env;exec-form shell CMD sodocker stopsignals reach streamlit directly;title/description/source/licenses) so the registry page links back to this repository;SETUPTOOLS_SCM_PRETEND_VERSIONbuild arg pins the version, since hatch-vcs cannot see.gitin the build context.docker-compose.yml(compose v2 spec, noversion:key):restart: unless-stopped, binds127.0.0.1:8501only — the reverse proxy in front remains the public entry point and is unchanged.Verification
docker compose up -d --build→ container reportshealthy, streamlit 1.66.1 inside;/_stcore/health→ok, page → 200, websocket upgrade →101 Switching Protocols;appuser, restart policyunless-stopped.Notes
# syntax=directive: the bundled BuildKit frontend supports everything used here, keeping builds network-independent;publish.yml(same tag pipeline,GITHUB_TOKENwithpackages: write) — deferred until this is proven stable;docker compose buildpicks up the new app on the next rebuild.