Skip to content

refactor: use docker/secrets-engine SDK and writable bind mounts in Dockerfile#529

Open
joe0BAB wants to merge 2 commits into
docker:mainfrom
joe0BAB:feat/se-sdk
Open

refactor: use docker/secrets-engine SDK and writable bind mounts in Dockerfile#529
joe0BAB wants to merge 2 commits into
docker:mainfrom
joe0BAB:feat/se-sdk

Conversation

@joe0BAB

@joe0BAB joe0BAB commented Jun 30, 2026

Copy link
Copy Markdown

What I did

  • Use the docker/secrets-engine SDK in secretsengine.go: Replaced the hand-rolled connectRPC-over-Unix-socket implementation in the secret-management package with the public github.com/docker/secrets-engine client SDK.

    • GetSecrets/GetSecret now use client.New + Resolver.GetSecrets instead of manually constructing HTTP requests, JSON payloads, and the RPC path.
    • Use realms.DockerMCPDefault for the docker/mcp/** pattern and client.ParsePattern for single-key lookups.
    • Pin the client to the engine socket via api.DefaultSocketPath(), dropping the local socketPath()/newHTTPClient() helpers.
    • Return the SDK's client.Envelope directly (ID is now secrets.ID); callers that used the ID as a string now call .ID.String().
    • Update the config-validation test fake to serve the real resolver connect protocol so an empty result maps to ErrSecretNotFound.
  • Replace rsync with writable bind mounts in the Dockerfile: Replaced the tmpfs + rsync pattern in the docs-build and docs-validate stages with a writable bind mount (--mount=type=bind,target=.,rw). Avoids copying the full source tree and removes the rsync dependency from the base image. Build output is still exported via /out and scratch stages.

  • Bump Go version: Bumped the go directive to 1.25.11 (required by the SDK modules) and the Dockerfile GO_VERSION to match. Vendored accordingly.

joe0BAB added 2 commits June 30, 2026 11:43
Replace the tmpfs + rsync pattern in docs-build and docs-validate stages
with a writable bind mount (--mount=type=bind,target=.,rw). This avoids
copying the full source tree and removes the rsync dependency from the
base image. Build output is still exported via /out and scratch stages.

Also bump GO_VERSION from 1.25.5 to 1.25.11 to match go.mod's minimum.
Replace the hand-rolled connectRPC-over-Unix-socket implementation in the
secret-management package with the public github.com/docker/secrets-engine
client SDK.

- GetSecrets/GetSecret now use client.New + Resolver.GetSecrets instead of
  manually constructing HTTP requests, JSON payloads, and the RPC path.
- Use realms.DockerMCPDefault for the docker/mcp/** pattern and
  client.ParsePattern for single-key lookups.
- Pin the client to the engine socket via api.DefaultSocketPath(), dropping
  the local socketPath()/newHTTPClient() helpers.
- Return the SDK's client.Envelope directly (ID is now secrets.ID); callers
  that used the ID as a string now call .ID.String().
- Update the config-validation test fake to serve the real resolver connect
  protocol so an empty result maps to ErrSecretNotFound (engine reachable,
  no secrets) rather than a transport error.

Bumps the go directive to 1.25.11 (required by the SDK modules) and the
Dockerfile GO_VERSION to match. Vendored accordingly.
@joe0BAB joe0BAB requested a review from a team as a code owner June 30, 2026 09:46
@joe0BAB joe0BAB changed the title Feat/se sdk refactor: use docker/secrets-engine SDK and writable bind mounts in Dockerfile Jun 30, 2026
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