Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cs25-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ LABEL type="application" module="cs25-service"
# 작업 디렉토리
WORKDIR /apps

# Node.js + npm 설치 후, MCP 서버 전역 설치
RUN apt-get update && apt-get install -y curl ca-certificates gnupg \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g @modelcontextprotocol/server-brave-search \
&& node -v && npm -v && which server-brave-search \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
Comment on lines +23 to +29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

런타임에 Node+MCP CLI 설치는 목적에 부합합니다. 재현성(버전 고정)·이미지 슬림화 개선 제안

  • 버전 고정: 최신으로 깔리는 nodejs/npm/CLI는 재현성을 해칩니다. server-brave-search에 버전 핀 권장(@x.y.z 또는 ARG 사용).
  • 이미지 슬림화: apt에 --no-install-recommends, npm cache clean, 사용 후 gnupg purge로 공격면/용량 축소.
  • 디버그 출력(node -v 등)은 일시적 점검엔 유용하나, 불필요하면 제거 가능.

상단(ENTRYPOINT 이전) 어딘가에 다음 ARG를 추가:

ARG MCP_BRAVE_VERSION=0.1.x

변경 구간에 대한 제안 Diff:

-RUN apt-get update && apt-get install -y curl ca-certificates gnupg \
-  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
-  && apt-get install -y nodejs \
-  && npm install -g @modelcontextprotocol/server-brave-search \
-  && node -v && npm -v && which server-brave-search \
-  && apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates gnupg \
+  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
+  && apt-get install -y --no-install-recommends nodejs \
+  && npm install -g @modelcontextprotocol/server-brave-search@${MCP_BRAVE_VERSION} \
+  && npm cache clean --force \
+  && node -v && npm -v && which server-brave-search \
+  && apt-get purge -y gnupg && apt-get autoremove -y --purge \
+  && apt-get clean && rm -rf /var/lib/apt/lists/*

필요 시 디버그 출력(node -v, npm -v, which …)은 빌드 안정화 후 제거 가능.

🤖 Prompt for AI Agents
In cs25-service/Dockerfile around lines 23 to 29, pin the MCP CLI version and
slim the image: add an ARG (e.g. MCP_BRAVE_VERSION) near the top and change the
npm install to use that ARG (install
@modelcontextprotocol/server-brave-search@${MCP_BRAVE_VERSION}); install apt
packages with --no-install-recommends, run npm cache clean --force after npm
install, and remove gnupg via apt-get purge -y gnupg (or rm -rf its data) before
cleaning apt lists; remove or comment out transient debug prints (node -v, npm
-v, which ...) unless needed for debugging.


# jar 복사
COPY --from=builder /build/cs25-service/build/libs/*.jar app.jar

Expand Down
5 changes: 2 additions & 3 deletions cs25-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ spring.ai.mcp.client.type=SYNC
spring.ai.mcp.client.request-timeout=30s
spring.ai.mcp.client.root-change-notification=false
# STDIO Connect: Brave Search
spring.ai.mcp.client.stdio.connections.brave.command=npx
spring.ai.mcp.client.stdio.connections.brave.args[0]=-y
spring.ai.mcp.client.stdio.connections.brave.args[1]=@modelcontextprotocol/server-brave-search
spring.ai.mcp.client.stdio.connections.brave.command=server-brave-search
spring.ai.mcp.client.stdio.connections.brave.env.BRAVE_API_KEY=${BRAVE_API_KEY}
spring.ai.mcp.client.initialized=false
#MAIL
spring.mail.host=smtp.gmail.com
spring.mail.port=587
Expand Down