Skip to content

ci: smoke-test the container image on every PR - #323

Merged
smaramwbc merged 1 commit into
mainfrom
ci/docker-smoke-test
Aug 2, 2026
Merged

ci: smoke-test the container image on every PR#323
smaramwbc merged 1 commit into
mainfrom
ci/docker-smoke-test

Conversation

@smaramwbc

Copy link
Copy Markdown
Owner

Closes #293.

Why

Two related gaps, both surfaced while reviewing #321:

  1. CI never touches the image we ship. The test job runs pip install -e ".[dev]" against the source tree, so a Dockerfile change can pass every check and still produce a container that exits during boot — and docker-publish would push it as latest with no smoke test between build and push.
  2. The "duplicate" install in the Dockerfile looks removable, but isn't. The first pip install runs before COPY . ., so hatchling (packages = ["server"]) builds a wheel with no application code. The second install is what actually puts server/ into site-packages. start.sh runs alembic upgrade head first, and the alembic console script doesn't put the working directory on sys.path — so removing it makes the container exit before uvicorn starts.

What

  • docker-smoke CI job — builds the image, runs it against a pgvector service, waits for /healthz, and fails fast with container logs if the container exits first.
  • Dockerfile comments explaining why both installs exist, so this doesn't read as dead code again.
  • --no-deps on the second install, making it explicit that only the application package is installed there (dependencies come from the cached layer above).

Verified locally

image result
current Dockerfile ✅ healthy in ~3s
--no-deps variant (this PR) ✅ healthy in ~2s, server present in site-packages
image with the second install removed (the #321 shape) container exited, code 1

That last row is the point: this job catches the exact regression that passed CI green.

The test job installs the package from the source tree with `pip install -e`,
so nothing in CI ever built or ran the image we publish. A change to the
Dockerfile could pass every check and still produce a container that exits
during boot, which docker-publish would then push as `latest`.

Add a docker-smoke job that builds the image, runs it against a pgvector
service and waits for /healthz, failing fast with container logs if the
container exits first. Verified against a known-bad image: it reports healthy
in ~3s for the current Dockerfile and fails immediately when the application
package is missing from site-packages.

Also document why the Dockerfile installs twice. The second install looks
redundant but is what puts `server/` into site-packages, since the first runs
before `COPY . .`; without it `alembic upgrade head` in start.sh fails with
ModuleNotFoundError. Marked `--no-deps` to make it explicit that only the
application package is installed there.

Closes #293
@smaramwbc
smaramwbc merged commit c4e4cf6 into main Aug 2, 2026
6 checks passed
@smaramwbc
smaramwbc deleted the ci/docker-smoke-test branch August 2, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dockerfile installs the package twice, wasting build time

1 participant