Repository navigation
Conversation
The dependency layer is now reused across deploys: dependencies install from a `uv export` that leaves the project out, so the version bump every spec regeneration makes in uv.lock no longer reinstalls them. Bytecode is compiled at build time, so workers are ready about 3.6 s sooner on each start. The runtime image holds Python and the virtualenv only, runs as a non-root user, and gets its build context from an allowlist .dockerignore. CI builds both Dockerfiles and smoke-tests the image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eads it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Closing: Railway build logs show the Docker build is ~6 s of a ~35 s deploy (uv sync ~2 s), so the caching gain is negligible. Not worth the change for now. |
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 changes
The image Railway deploys (
Dockerfile), and its plain-Docker copy (Dockerfile.docker), now follow Docker's and uv's best practices.srcwas copied beforeuv sync, anduv.lockchanges on every spec regeneration (139 commits touched it in 7 days)uv exportthat leaves out the project's version. The exported list is byte-identical across version bumps, so the layer is reusedUV_COMPILE_BYTECODE=1)src, the lockfile and an editable installpython:3.12-slim-bookwormwith only the virtualenv. The project is a non-editable installapp(uid 10001). The venv is root-owned and read-only to ituv:python3.12-bookworm-slim(floating uv)0.13.7, Python3.12-slim-bookworm.dockerignore:apps-src,openapi.yaml,scripts,.railwayetc. were sentpyproject.toml,uv.lock,README.md,src/PYTHONUNBUFFERED=1These are kept as they were:
CMD, so the server is PID 1 and receives SIGTERM (fix(mcp): exec the server so a deploy's SIGTERM reaches it #79).MALLOC_ARENA_MAX=2(fix(mcp): stop the hosted server's memory growing until the next deploy #69).EXPOSE 8080, and Railway's/healthcheck.The Railway
Dockerfilehas no BuildKit cache mount, because Railway requires the mount ID to carry the service ID (s/<service-id>-…). The layer reuse above gives the same benefit without one.CI gets a new
dockerjob. It builds both Dockerfiles and checks four things:/healthanswersPOST /mcpwithout a token gets the 401 OAuth challengedocker stopexits 0tests/test_dockerfile_signals.pyalso now checks that both Dockerfiles set a non-rootUSER.Verified locally
Local Docker isn't available (no access to the Docker socket), so I ran each image stage's commands in a clean directory. The build context was exactly what
.dockerignoreallows. The server then ran from the resulting virtualenv, with the venv made read-only,srcdeleted, and the working directory outside the repo. The CI job above does the realdocker build.Export: the exports for 1.4.1853 and 1.4.1855 differ only in the header line that names the output path, and that path is fixed inside the image.
Builder:
uv syncinstalled only the project (Installed 1 package) on top of the exported dependencies. It compiled 3,423 files.Package data is in the installed package:
landing.html,logo.svg, the MCP App bundle and its fonts.4 workers:
/healthreturned 503 until all were ready, then 200.Endpoints:
GET /serves JSON and the HTML landing page.POST /messages/returns 410 with the migration body./mcpwithout a token returns 401.initializesucceeds on/mcp,/sseand/chatgpt.Tools: 8 of 8
tools/listcalls across workers returned 44 tools. A realdocs_searchtool call succeeded.With
ZERNIO_MCP_APPS=1:ui://zernio/v2/app.htmlis served at 501 KB.Shutdown: SIGTERM shuts all workers down gracefully, with exit code 0.
No runtime writes: no
.pycfiles were written at runtime.Startup time to a healthy 4-worker server, measured twice each:
Tests:
pytest tests/test_dockerfile_signals.py tests/test_mcp_sse_retired.py→ 10 passed.Rollout
Nothing to configure: Railway builds
Dockerfileas before. Merging deploys production. If it fails to come up, the deploy health check keeps the current deployment serving. To roll back, revert this PR.🤖 Generated with Claude Code