chore: fixes, self-contained scratch image, and dev-flow improvements#325
Merged
Conversation
…mage IS_SEMVER only matched X.Y.Z, so a stable vX.Y.Z tag would publish a GitHub release marked "Latest" without updating the docker :latest tag. Accept an optional leading v so vX.Y.Z and X.Y.Z both push :latest, while -preview/-draft suffixes stay non-latest. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- #309: 'Copy as curl' no longer wraps a raw/urlencoded body in extra quotes (only JSON bodies are serialized; a string body is used as-is). - #313: response headers are served with the exact casing the mock declares instead of Go's canonical form (e.g. 'BrokerProperties' stays as-is), matching servers that treat header names case-sensitively. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mage #180: the built client is baked into the binary with go:embed, so a released binary/image is self-contained. --static-files still takes precedence when it holds an index.html (development and explicit overrides), otherwise the embedded UI is served. A committed dist/.gitkeep keeps 'go build' working before the client is built; the release build and Dockerfile copy the client into the embed source. The docker image no longer ships a separate client directory. #68: add a 'smoke-docker' target (config API answers, embedded UI is served, and a registered mock is served on the mock port) and run it in CI after start-docker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Build the binary statically (CGO_ENABLED=0) and put it on a scratch base instead of alpine: the UI is already embedded (go:embed) and CA roots are copied in for the proxy mock type's HTTPS backends, so nothing else is needed. Result is an ~18 MB image with no OS/shell — smaller and a much smaller attack surface. Validated with podman: embedded UI served, local mock round-trip, and an HTTPS proxy call all succeed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add USER 65534:65534 to the scratch image so smocker runs unprivileged by default. The listen ports are >1024 (no privilege needed to bind); a mounted persistence directory must be writable by this uid. Validated with podman: the process runs as uid 65534 and still serves the UI, mock round-trips, and HTTPS proxy calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Vite dev server served index.html with the raw Go template placeholders
({{.basePath}}/{{.version}}) and had no API proxy, so the app's API base and
<base href> were broken and calls hit the SPA fallback. Add a serve-only
transformIndexHtml that substitutes the placeholders in dev, a server.proxy for
the admin API routes to the backend (SMOCKER_DEV_PROXY overridable), and serve
from base '/' in dev while the build keeps './' for the Go <base href>. The
production build is unchanged (placeholders + assets/ prefix preserved).
Update the README dev commands (yarn -> npm) accordingly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e the v tag convention - Dependabot now also updates Go modules and npm packages (grouped, weekly), not just actions. - check-default-ports also verifies the go-httpbin proxy port (PROXY_TARGET_PORT, 8090). - Document the 'vX.Y.Z' tag convention in the CI trigger comments (bare X.Y.Z still works). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
A batch of small fixes and build/tooling improvements gathered while triaging the issues.
No change to the mock format, its serialization, or the HTTP/CLI API.
Fixes (from the issue triage)
bodies are serialized).
canonicalizes e.g.
BrokerProperties), matching case-sensitive servers.Build / packaging
go:embed, Use Go 1.16 embed API to package the binary #180): a released binary/image isself-contained;
--static-filesstill overrides for development.FROM scratch, static (CGO_ENABLED=0) + CA roots for the proxy →~18 MB, no OS/shell.
smoke-dockertarget (config API, embedded UI, mockround-trip), run in CI after
start-docker.Dev experience
npm run devworks against the backend: the Vite dev server now substitutes the Gotemplate placeholders and proxies the admin API to
make start(SMOCKER_DEV_PROXYoverridable). Production build unchanged.
Release / CI hygiene
IS_SEMVERaccepts a leadingv, so a stablevX.Y.Ztag updates the docker:latest.check-default-portsalso checks the go-httpbin proxy port; document thevX.Y.Ztag convention.Test plan
go test ./server/..., golden serialization tests,vitest,tsc,oxlint,golangci-lint— green locally.image with podman (self-contained image serves the UI + mocks; HTTPS proxy works).
npm run devserves substituted placeholders and proxies the API.Closes #309
Closes #313
🤖 Generated with Claude Code