Skip to content

fix: copy openapi.yaml into Docker production image#169

Open
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/dockerfile-copy-openapi-yaml
Open

fix: copy openapi.yaml into Docker production image#169
0x-SquidSol wants to merge 1 commit intodcccrypto:mainfrom
0x-SquidSol:fix/dockerfile-copy-openapi-yaml

Conversation

@0x-SquidSol
Copy link
Copy Markdown
Contributor

Summary

  • Issue: The Dockerfile never copies openapi.yaml into the production image. The /docs/openapi.yaml endpoint reads it at runtime via fs.readFile("/app/openapi.yaml"), but that file doesn't exist in the container — guaranteed 500 error on the /docs endpoint in production.
  • Root cause: Builder stage only copies package.json, lockfiles, tsconfig.json, and src/. Runner stage only copies dist/, node_modules/, package.json. tsc doesn't copy non-TS files. openapi.yaml lives at the project root, outside src/.
  • Fix: Add COPY openapi.yaml ./ to the runner stage (1 line).

Path trace

src/routes/docs.ts:14 → join(__dirname, "..", "..", "openapi.yaml")
At runtime: __dirname = /app/dist/routes/
Resolves to: /app/openapi.yaml ← does not exist without this fix

Test plan

  • tsc --noEmit passes
  • vitest run passes (186/186 tests)
  • Docker build: verify /app/openapi.yaml exists in final image
  • curl localhost:3001/docs/openapi.yaml returns YAML, not 500

🤖 Generated with Claude Code

The Dockerfile runner stage only copied dist/, node_modules/, and
package.json from the builder. The openapi.yaml file (read at runtime
by /docs/openapi.yaml endpoint via fs.readFile) was never included,
causing a guaranteed 500 error on the /docs endpoint in production.

The builder stage also never copied it in (only package.json,
lockfiles, tsconfig, and src/). Since openapi.yaml is a runtime
asset not needed at build time, copy it directly from the build
context into the runner stage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

Warning

Rate limit exceeded

@0x-SquidSol has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2d97a60e-4740-434a-a12d-91c774dbec52

📥 Commits

Reviewing files that changed from the base of the PR and between fb94c29 and da8935a.

📒 Files selected for processing (1)
  • Dockerfile
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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