feat(docker_server): slim build branch (no in-image proxy)#2402
Draft
ndeepak-baseten wants to merge 4 commits into
Draft
feat(docker_server): slim build branch (no in-image proxy)#2402ndeepak-baseten wants to merge 4 commits into
ndeepak-baseten wants to merge 4 commits into
Conversation
2526c92 to
de8d45d
Compare
Adds a docker_server build that omits nginx and supervisord. Triggered by BT_USE_DOCKER_SERVER_SLIM=true. The customer's start_command runs as PID 1. Routing and probes are the deploying platform's responsibility. Distinct from the sidecar branch in #2357: that PR pairs with an external nginx sidecar in the pod. This one assumes no nginx anywhere (in-image or sidecar). Both can coexist; gates are separate env vars. Transport-agnostic; the customer's start_command runs PID 1 regardless of HTTP or gRPC. Made-with: Cursor
Two correctness fixes for the docker_server slim build branch:
1) _should_use_docker_server_slim was using os.getenv(..., False) which
treats any non-empty string ("false", "0", etc.) as truthy. Switch to
explicit "true" comparison so only that exact value enables slim.
2) Add a no_build guard. no_build images ship with a customer-supplied
ENTRYPOINT/CMD; the slim branch overrides those, so we must not enter
it for no_build regardless of the slim flag.
Also drop the unused DOCKER_SERVER_SLIM env var from the slim Dockerfile
branch (the operator never reads it). Add unit tests for both gates.
Made-with: Cursor
Test names + parametrize values already say what each test pins. Made-with: Cursor
a278fba to
3af0b54
Compare
Co-authored-by: Cursor <cursoragent@cursor.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.
What
Adds a
docker_serverbuild that omits nginx and supervisord. Triggered byBT_USE_DOCKER_SERVER_SLIM=true. Customer'sstart_commandruns as PID 1. Routing and probes are the deploying platform's responsibility.Distinct from #2357: that PR keeps an external nginx in the pod (sidecar). This one assumes no nginx anywhere (in-image or sidecar). Both gates are separate env vars and can coexist.
How
_should_use_docker_server_slim(config)predicate gates the slim path.serving_image_builder.prepare_image_build_dirskips nginx/supervisord scaffolding for slim builds.server.Dockerfile.jinjaadds a slim branch underconfig.docker_server: setsDOCKER_SERVER_SLIMandSERVER_START_CMD, switches users, runsENTRYPOINT ["sh", "-c"]+CMD [start_command].Transport-agnostic; the customer's start_command runs PID 1 regardless of HTTP or gRPC.
Testing
uv run pytest truss/tests/contexts/image_builder/test_serving_image_builder.py::TestDockerServerSlimBuildcovers slim path (parametrized over http and grpc) and legacy fallback when env var unset.Release requirements