feat: ship official Docker image and docker compose (closes #278) - #296
Open
Madhumasa84 wants to merge 1 commit into
Open
Madhumasa84 wants to merge 1 commit into
Madhumasa84 wants to merge 1 commit into
Conversation
…rismorSec#278) - Add multi-stage Dockerfile (python:3.12-slim, UID 10001, read-only rootfs, ports 7070/7071, healthcheck via prismor status) - Add docker-compose.yml with dashboard, eval-server (profile), cron (profile) services; prismor_data volume; --cap-drop ALL, no-new-privs - Add .dockerignore - Add tests/test_docker.py (3 tests: Dockerfile, .dockerignore, compose) - Update .github/workflows/release.yml: docker job builds multi-arch linux/amd64+arm64 and pushes to ghcr.io on release tags - Update docs/docker.md with deployment and hardening guide - Fix prismor/__init__.py: extend __path__ via pkgutil so adapter subpackage imports resolve during pip install -e . dev runs - Fix prismor/runtime/scanner.py: tomllib fallback to tomli for Python < 3.11 All 1956 tests pass; OSS guard clean; policy schema valid.
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.
Problem
There was a
docs/docker.mdguide but no officialDockerfileordocker-compose.ymlin the repository, makingbare-metal Python installs the only supported deployment method. Users and teams running automated agent pipelines
lacked an official, pre-hardened, unprivileged container image and compose setup for the web dashboard, evaluation
server, and periodic audit jobs.
Closes #278
Prior art - what already exists
Followed the standard multi-stage Python container pattern (building standard wheels in stage 1 with
hatchlingand installing into a minimalpython:3.12-slimrunner in stage 2). Leveraged existing CLI entry points(
prismor dashboard,prismor eval-server,prismor status) for service commands and Docker healthchecks, applyingcontainer security best practices (
USER 10001:10001,--read-onlyrootfs,cap_drop: [ALL],no-new-privileges).Tangential updates:
prismor/__init__.py: Extended package__path__viapkgutil.extend_pathso adapter subpackages resolvecorrectly across editable dev installs and test suites.
prismor/runtime/scanner.py: Added fallback totomlifor environments running on Python < 3.11.Solution - high level
Dockerfilebased onpython:3.12-slimrunning as non-root userUID 10001 (prismor), supporting--read-onlyrootfs, exposing ports 7070/7071, and usingprismor statusforHEALTHCHECK.docker-compose.ymldefiningdashboard(default),eval-server(profile), and periodiccron(profile)services with persistent SQLite storage (
prismor_datavolume) and dropped capabilities..dockerignoreand integrated multi-arch (linux/amd64,linux/arm64) container builds and GHCR publishinginto
.github/workflows/release.yml.tests/test_docker.pyand updateddocs/docker.mdwith complete deployment,compose, and security hardening documentation.
Deep dive - how it works
builder) installs build dependencies and packages the wheel; Stage 2 (runner)copies and installs the standalone wheel and cleans up temporary files, keeping the final runtime image lean (~200MB).
UID 10001:10001. The container root filesystemis compatible with
--read-onlybecause all state writes are isolated to/home/prismor/.prismor(mounted as a volumeor tmpfs). The host workspace is mounted read-only at
/workspace.docker compose upstarts the dashboard on port7070by default. Runningdocker compose - -profile eval-server upenables the HTTP evaluation server (port7071), and--profile cronruns periodic workspacesecurity audits.
.github/workflows/release.ymlbuilds and pushes multi-platform images (linux/amd64and
linux/arm64) toghcr.io/prismorsec/prismortagged with semver versions andlateston release tags.Files changed
Dockerfiledocker-compose.ymldashboard,eval-server,cron), volume mounts, dropped.dockerignore.github/workflows/release.ymldockerjob for multi-arch build and GHCR push on release tagsdocs/docker.mdtests/test_docker.pyprismor/__init__.py__path__viapkgutil.extend_pathfor adapter package discoveryprismor/runtime/scanner.pytomllibtotomlifor Python < 3.11 compatibilityTesting