Skip to content

Fix dockerfile#52

Open
christianwengert wants to merge 4 commits intodadbodgeoff:mainfrom
christianwengert:fix-dockerfile
Open

Fix dockerfile#52
christianwengert wants to merge 4 commits intodadbodgeoff:mainfrom
christianwengert:fix-dockerfile

Conversation

@christianwengert
Copy link
Contributor

Description

I was not able to build the docker image with docker build -t mcp-drift . resulting in

 docker build   -t mcp-drift .
[+] Building 11.1s (23/45)                                                                                                                                                                docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                      0.0s
 => => transferring dockerfile: 4.40kB                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/node:20-slim                                                                                                                                           0.5s
 => [internal] load .dockerignore                                                                                                                                                                         0.0s
 => => transferring context: 683B                                                                                                                                                                         0.0s
 => [builder  1/22] FROM docker.io/library/node:20-slim@sha256:c6585df72c34172bebd8d36abed961e231d7d3b5cee2e01294c4495e8a03f687                                                                           0.0s
 => => resolve docker.io/library/node:20-slim@sha256:c6585df72c34172bebd8d36abed961e231d7d3b5cee2e01294c4495e8a03f687                                                                                     0.0s
 => [internal] load build context                                                                                                                                                                         0.1s
 => => transferring context: 2.14MB                                                                                                                                                                       0.1s
 => CACHED [builder  2/22] RUN corepack enable && corepack prepare pnpm@8.10.0 --activate &&     apt-get update && apt-get install -y python3 make g++ &&     rm -rf /var/lib/apt/lists/*                 0.0s
 => CACHED [builder  3/22] WORKDIR /app                                                                                                                                                                   0.0s
 => CACHED [builder  4/22] COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./                                                                                                             0.0s
 => CACHED [builder  5/22] COPY tsconfig.json tsconfig.base.json ./                                                                                                                                       0.0s
 => CACHED [builder  6/22] COPY packages/core/package.json packages/core/tsconfig.json ./packages/core/                                                                                                   0.0s
 => CACHED [builder  7/22] COPY packages/mcp/package.json packages/mcp/tsconfig.json ./packages/mcp/                                                                                                      0.0s
 => CACHED [builder  8/22] COPY packages/detectors/package.json packages/detectors/tsconfig.json ./packages/detectors/                                                                                    0.0s
 => CACHED [builder  9/22] COPY packages/cli/package.json packages/cli/tsconfig.json ./packages/cli/                                                                                                      0.0s
 => CACHED [builder 10/22] COPY packages/cortex/package.json packages/cortex/tsconfig.json ./packages/cortex/                                                                                             0.0s
 => CACHED [builder 11/22] RUN echo 'packages:\n  - "packages/core"\n  - "packages/detectors"\n  - "packages/mcp"\n  - "packages/cli"\n  - "packages/cortex"' > pnpm-workspace.yaml                       0.0s
 => CACHED [builder 12/22] RUN pnpm install --frozen-lockfile                                                                                                                                             0.0s
 => [builder 13/22] COPY packages/core/src ./packages/core/src                                                                                                                                            0.0s
 => [builder 14/22] COPY packages/mcp/src ./packages/mcp/src                                                                                                                                              0.0s
 => [builder 15/22] COPY packages/detectors/src ./packages/detectors/src                                                                                                                                  0.0s
 => [builder 16/22] COPY packages/cli/src ./packages/cli/src                                                                                                                                              0.0s
 => [builder 17/22] COPY packages/cortex/src ./packages/cortex/src                                                                                                                                        0.0s
 => [builder 18/22] RUN cd packages/detectors && pnpm build                                                                                                                                               4.9s
 => ERROR [builder 19/22] RUN cd packages/core && pnpm build                                                                                                                                              5.4s
------
 > [builder 19/22] RUN cd packages/core && pnpm build:
0.313 
0.313 > driftdetect-core@0.9.47 build /app/packages/core
0.313 > tsc
0.313 
5.318 src/storage/repositories/audit-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/boundary-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/callgraph-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/constraint-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/contract-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/dna-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/environment-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/pattern-repository.ts(10,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/repositories/test-topology-repository.ts(9,27): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.318 src/storage/unified-store.ts(10,22): error TS2307: Cannot find module 'better-sqlite3' or its corresponding type declarations.
5.343  ELIFECYCLE  Command failed with exit code 2.
------
Dockerfile:43
--------------------
  41 |     
  42 |     # Build core (depends on detectors)
  43 | >>> RUN cd packages/core && pnpm build
  44 |     
  45 |     # Build cortex
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c cd packages/core && pnpm build" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/bx4esbglkejtn8fhuor6x12z0

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • New detector
  • Performance improvement
  • Refactoring (no functional changes)

Related Issues

Fixes #(issue number)

How Has This Been Tested?

  • Unit tests pass (pnpm test)
  • Linting passes (pnpm lint)
  • Build succeeds (pnpm build)
  • Manual testing (describe below)

docker build now works

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

Add screenshots to help explain your changes.

Additional Notes

Any additional information reviewers should know.

dadbodgeoff pushed a commit that referenced this pull request Feb 3, 2026
- Add drift_setup to CORE_TOOLS in tool-filter.ts so it's always exposed
- Fix path resolution in enterprise-server.ts for drift_setup:
  - Treat project parameter as a PATH, not a project name
  - Skip registry lookup since project may not exist yet (e.g., for init action)
  - Add security check to prevent path traversal
- Fix path resolution for drift_projects action=register:
  - Skip registry lookup since project parameter is the NAME for new project
  - Use args.path for the actual path
  - Add security check to prevent path traversal
- Update Dockerfile with PR #52 fixes:
  - Add packages/cortex to build (required by MCP server)
  - Fix build order: detectors → core → cortex → mcp
  - Change /project to /workspace for mounting
  - Add --verbose flag to CMD
  - Remove --frozen-lockfile to handle lockfile drift

Fixes issue where drift_setup action=init with absolute path would fail
with 'Project not found' error because it tried to look up the path
in the project registry before the project was initialized.
dadbodgeoff pushed a commit that referenced this pull request Feb 3, 2026
- Add drift_setup to CORE_TOOLS in tool-filter.ts so it's always exposed
- Fix path resolution in enterprise-server.ts for drift_setup:
  - Treat project parameter as a PATH, not a project name
  - Skip registry lookup since project may not exist yet (e.g., for init action)
  - Add security check to prevent path traversal
- Fix path resolution for drift_projects action=register:
  - Skip registry lookup since project parameter is the NAME for new project
  - Use args.path for the actual path
  - Add security check to prevent path traversal
- Update Dockerfile with PR #52 fixes:
  - Add packages/cortex to build (required by MCP server)
  - Fix build order: detectors → core → cortex → mcp
  - Change /project to /workspace for mounting
  - Add --verbose flag to CMD
  - Remove --frozen-lockfile to handle lockfile drift

Fixes issue where drift_setup action=init with absolute path would fail
with 'Project not found' error because it tried to look up the path
in the project registry before the project was initialized.

Co-authored-by: christianwengert <christianwengert@users.noreply.github.com>
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