Skip to content

fix(docker): include OpenAPI spec in runtime image#2007

Merged
diegosouzapw merged 1 commit intodiegosouzapw:release/v3.8.0from
tatsster:fix-docker-openapi-spec
May 7, 2026
Merged

fix(docker): include OpenAPI spec in runtime image#2007
diegosouzapw merged 1 commit intodiegosouzapw:release/v3.8.0from
tatsster:fix-docker-openapi-spec

Conversation

@tatsster
Copy link
Copy Markdown

@tatsster tatsster commented May 6, 2026

Summary

This PR includes docs/openapi.yaml in the Docker runtime image.

It fixes the Endpoints dashboard showing:

openapi.yaml not found

when OmniRoute is deployed from the published Docker image with Docker Compose.

Affected setup

The issue was seen with a straightforward Docker Compose deployment using the published image:

services:
  omniroute:
    image: diegosouzapw/omniroute:latest
    container_name: omniroute
    restart: unless-stopped
    stop_grace_period: 40s
    env_file:
      - .env
    ports:
      - "20128:20128"
    volumes:
      - /root/omniroute/data:/app/data

In this setup the app itself starts normally and the dashboard is reachable, but the Endpoints dashboard cannot load the OpenAPI catalog because /api/openapi/spec cannot find openapi.yaml inside the container.

Root cause

src/app/api/openapi/spec/route.ts reads the OpenAPI spec from disk at runtime:

process.cwd()/docs/openapi.yaml
process.cwd()/app/docs/openapi.yaml

However, the Docker image uses Next.js standalone output:

COPY --from=builder /app/.next/standalone ./

Files that are read dynamically with fs are not always included in the standalone output. The current Dockerfile already handles this pattern for other runtime filesystem assets, for example migrations are copied explicitly:

COPY --from=builder /app/src/lib/db/migrations ./migrations

docs/openapi.yaml needs the same treatment because it is read by /api/openapi/spec at runtime for the Endpoints dashboard.

Fix

Copy the OpenAPI spec into the runtime image:

COPY --from=builder /app/docs/openapi.yaml ./docs/openapi.yaml

This makes the file available at /app/docs/openapi.yaml, which matches the route's existing lookup path when the container runs with WORKDIR /app.

Screenshot

Current behavior before this fix:

Endpoints dashboard showing openapi.yaml not found

Testing

  • Commit hook docs sync passed: OpenAPI version matches package.json
  • Commit hook any-budget check passed
  • Local source route test previously confirmed the spec parses and exposes 171 endpoints

Expected result after rebuilding the image

After rebuilding/redeploying the Docker image from this Dockerfile, /app/docs/openapi.yaml should exist in the container and the Endpoints dashboard should be able to load the OpenAPI endpoint catalog instead of showing openapi.yaml not found.

@tatsster tatsster requested a review from diegosouzapw as a code owner May 6, 2026 17:18
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Dockerfile to explicitly copy the OpenAPI specification file into the final image. This ensures the file is available at runtime for the Endpoints dashboard, as it is not automatically included by Next.js standalone tracing. I have no feedback to provide as there were no review comments.

@diegosouzapw diegosouzapw changed the base branch from main to release/v3.8.0 May 7, 2026 11:24
@diegosouzapw
Copy link
Copy Markdown
Owner

Thank you @tatsster for your contribution! This has been reviewed and is now merged into release/v3.8.0 for the upcoming release. Amazing work!

@diegosouzapw diegosouzapw merged commit 40cc0d1 into diegosouzapw:release/v3.8.0 May 7, 2026
2 checks passed
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.

2 participants