Refactor/402 래퍼스크립트를 만들어 커맨드명 유지하도록 도커파일 수정#403
Conversation
Walkthroughcs25-service/Dockerfile updates Node.js to 22.x, switches the Brave Search MCP server package to @brave/brave-search-mcp-server, replaces a symlink with a Node.js wrapper script enforcing stdio transport, adjusts path handling, updates validation steps, and refines cleanup commands. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Wrapper as /usr/local/bin/server-brave-search
participant Node as Node.js
participant Module as @brave/brave-search-mcp-server (dist/index.js)
User->>Wrapper: server-brave-search [args]
Wrapper->>Node: node dist/index.js --transport stdio [args]
Node->>Module: Load and execute
Module-->>User: Runs MCP server over stdio
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
cs25-service/Dockerfile (5)
25-30: Node.js 22 설치 플로우 적절NodeSource 스크립트 기반 설치와 단일 RUN 레이어 병합이 깔끔합니다. 이후 단계에서 이미지 슬림화만 보완하면 좋겠습니다.
34-37: npm prefix 의존 경로 대신 require.resolve 기반 경로 계산 제안환경마다 npm prefix -g 결과가 달라질 수 있습니다. Node가 제공하는 require.resolve를 이용하면 더 견고합니다.
아래처럼 SRCDIR 계산만 대체해 주세요.
- && SRCDIR="${NPM_PREFIX}/lib/node_modules/@brave/brave-search-mcp-server" \ + && SRCDIR="$(node -p 'require(\"path\").dirname(require.resolve(\"@brave/brave-search-mcp-server/package.json\"))')" \
38-40: 래퍼 스크립트에서 --transport 중복 방지 로직 제안현재 스크립트는 항상 --transport stdio를 추가합니다. 호출자가 이미 --transport를 넘긴 경우 중복될 수 있으므로, 인자에 존재하면 그대로 통과하고 없을 때만 기본값을 추가하는 편이 안전합니다(의도적으로 강제하려는 경우라면 그대로 유지해도 무방).
아래처럼 간단한 체크를 추가한 1-liner 대체안을 제안합니다.
- && printf '#!/usr/bin/env bash\nexec node "%s/dist/index.js" --transport stdio "$@"\n' "$SRCDIR" > /usr/local/bin/server-brave-search \ + && printf '#!/usr/bin/env bash\nfor a in "$@"; do [[ "$a" == --transport* ]] && exec node "%s/dist/index.js" "$@"; done\nexec node "%s/dist/index.js" --transport stdio "$@"\n' "$SRCDIR" "$SRCDIR" > /usr/local/bin/server-brave-search \
42-44: which 대신 shell 내장 command -v 사용 및 오류 처리 그룹화일부 슬림 이미지에는 which가 없을 수 있습니다. command -v는 쉘 내장이라 추가 패키지 없이 동작합니다. 또한 || 블록을 {}로 명시적으로 감싸면 가독성과 의도가 분명해집니다.
아래로 교체를 제안합니다.
- && echo "=== which server-brave-search ===" && which server-brave-search \ - && echo "=== server-brave-search --help ===" && server-brave-search --help || (echo "[ERROR] server-brave-search 실행 실패" && exit 1) \ + && echo "=== command -v server-brave-search ===" && command -v server-brave-search >/dev/null \ + && echo "=== server-brave-search --help ===" && ( server-brave-search --help ) || { echo "[ERROR] server-brave-search 실행 실패"; exit 1; } \
46-50: 이미지 슬림화: gnupg 제거 추가 제안gnupg는 NodeSource 키 추가 후 더 이상 필요 없습니다. 명시적으로 purge하면 이미지가 더 작아집니다. autoremove만으로는 직접 설치한 패키지는 제거되지 않습니다.
아래처럼 정리 단계에 purge를 추가해 주세요.
# 정리 - && npm cache clean --force \ + && npm cache clean --force \ + && apt-get purge -y gnupg \ && apt-get autoremove -y --purge \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
| # 공식 패키지 설치 (deprecated 패키지 제거) | ||
| && npm install -g @brave/brave-search-mcp-server \ | ||
| \ |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
패키지 전환 OK. 다만 버전 고정 권장
@brave/brave-search-mcp-server 로의 전환 방향성은 적절합니다. 빌드 재현성을 위해 major/minor 버전 고정을 권장합니다(예: @brave/brave-search-mcp-server@^x.y). 최신 버전/존재 여부도 한 번 확인해 주세요.
아래 스크립트로 NPM 레지스트리에서 패키지 메타를 확인할 수 있습니다.
🏁 Script executed:
#!/bin/bash
# @brave/brave-search-mcp-server 패키지 최신 버전/타깃 존재 확인
set -euo pipefail
url="https://registry.npmjs.org/@brave%2Fbrave-search-mcp-server"
curl -fsSL "$url" | jq -r '.["dist-tags"].latest, .name'Length of output: 234
버전 고정 적용 필요: @brave/brave-search-mcp-server@^1.3 지정 권장
최신 버전(1.3.4) 확인 완료했습니다. 빌드 재현성을 위해 major.minor 단위로 버전 고정하세요.
• 위치: cs25-service/Dockerfile (31–33행)
• 변경 예시:
- && npm install -g @brave/brave-search-mcp-server \
+ && npm install -g @brave/brave-search-mcp-server@^1.3 \📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # 공식 패키지 설치 (deprecated 패키지 제거) | |
| && npm install -g @brave/brave-search-mcp-server \ | |
| \ | |
| # 공식 패키지 설치 (deprecated 패키지 제거) | |
| - && npm install -g @brave/brave-search-mcp-server \ | |
| + && npm install -g @brave/brave-search-mcp-server@^1.3 \ | |
| \ |
🤖 Prompt for AI Agents
In cs25-service/Dockerfile around lines 31–33, the global npm install for
@brave/brave-search-mcp-server lacks a version pin; update that install to pin
the package to the 1.3 minor series (e.g. @brave/brave-search-mcp-server@^1.3)
to ensure build reproducibility, adjust the Dockerfile line accordingly, and
rebuild/check the image so the pinned version (current 1.3.x) is used
consistently.
🔎 작업 내용
Summary by CodeRabbit