Skip to content

Build and smoke-test the Docker image in PR CI - #68

Merged
mitchallen merged 1 commit into
mainfrom
ci/docker-build-check
Aug 5, 2026
Merged

Build and smoke-test the Docker image in PR CI#68
mitchallen merged 1 commit into
mainfrom
ci/docker-build-check

Conversation

@mitchallen

Copy link
Copy Markdown
Owner

Closes the gap documented in #67: the publish workflows only run on v* tags, so a broken Dockerfile or build script stayed invisible until release.

That was a live gap, not a hypothetical — #66 replaced the yaml copy step of npm run build, and nothing in PR CI would have caught a container-level break.

What it does

A docker job that builds the image and smoke-tests the running container. It never pushes — the tag-triggered workflows still own publishing.

The assertions have teeth

The obvious check — grepping /api-docs output for openapi — is useless here, because the base definition is inlined in src/index.ts, so that string is present even with every yaml file missing from the image.

Verified against a purpose-built broken image (identical build with dist/**/*.yaml deleted):

Assertion Good image Broken image
grep openapi pass pass ← would not catch it
grep 'Get the service status' (from root.yaml) pass fail
grep ssnFour (from random-person.yaml) pass fail

The job also fails loudly with container logs if the server never becomes ready, so a crash-looping container reports rather than hanging to timeout.

Implementation note

Plain docker build rather than docker/build-push-action, matching publish.yml's existing style and avoiding another action to keep version-bumped.

This PR's own CI run is the proof it works.

🤖 Generated with Claude Code

The publish workflows only run on `v*` tags, so a broken Dockerfile or
build script stayed invisible until release. That was a live gap: #66
replaced the yaml copy step of `npm run build` and nothing in PR CI
would have caught a container-level break.

Adds a `docker` job that builds the image and smoke-tests the running
container. It never pushes — the tag-triggered workflows still own
publishing.

The swagger assertions deliberately avoid grepping for "openapi": the
base definition is inlined in src/index.ts, so that string is present
even when every yaml file is missing from the image. Verified against a
purpose-built broken image (same build with dist/**/*.yaml deleted) —
`openapi` still matched, while 'Get the service status' (from root.yaml)
and 'ssnFour' (from random-person.yaml) both correctly failed.

Uses plain `docker build` rather than docker/build-push-action, matching
publish.yml's style and avoiding another action to keep version-bumped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mitchallen
mitchallen merged commit 2a03960 into main Aug 5, 2026
2 checks passed
@mitchallen
mitchallen deleted the ci/docker-build-check branch August 5, 2026 17:56
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.

1 participant