diff --git a/cs25-service/Dockerfile b/cs25-service/Dockerfile index d839cf7b..20916674 100644 --- a/cs25-service/Dockerfile +++ b/cs25-service/Dockerfile @@ -22,37 +22,27 @@ LABEL type="application" module="cs25-service" # 작업 디렉토리 WORKDIR /apps -# Node.js 22 설치 + 공식 Brave MCP 서버 설치 + 래퍼 스크립트 생성 -RUN apt-get update \ - && apt-get install -y --no-install-recommends curl ca-certificates gnupg bash \ - && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - \ - # 공식 패키지 설치 (deprecated 패키지 제거) - && npm install -g @brave/brave-search-mcp-server \ - \ - # 전역 모듈 경로 계산 - && NPM_PREFIX="$(npm prefix -g)" \ - && SRCDIR="${NPM_PREFIX}/lib/node_modules/@brave/brave-search-mcp-server" \ - \ -# 실행 래퍼 (args는 전부 "$@"로 위임) -&& { \ - echo '#!/bin/sh'; \ - echo 'NODE=$(command -v node || echo /usr/bin/node)'; \ - echo 'exec "$NODE" "'"$SRCDIR"'/dist/index.js" "$@"'; \ -} > /usr/local/bin/server-brave-search \ -&& chmod 0755 /usr/local/bin/server-brave-search \ - \ - # 설치/실행 점검 - && 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) \ - \ - # 정리 - && npm cache clean --force \ - && apt-get autoremove -y --purge \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - +# Node.js 22 + Brave MCP 서버 설치 + 실행 래퍼 생성 +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends curl ca-certificates gnupg bash; \ + curl -fsSL https://deb.nodesource.com/setup_22.x | bash -; \ + apt-get install -y --no-install-recommends nodejs; \ + npm install -g @brave/brave-search-mcp-server; \ + NPM_PREFIX="$(npm prefix -g)"; \ + SRCDIR="${NPM_PREFIX}/lib/node_modules/@brave/brave-search-mcp-server"; \ + # 실행 래퍼 (전달 인자 전부 위임) + printf '%s\n' '#!/bin/sh' \ + 'exec node "'"$SRCDIR"'/dist/index.js" "$@"' \ + > /usr/local/bin/server-brave-search; \ + chmod 0755 /usr/local/bin/server-brave-search; \ + # sanity check (없으면 빌드 실패) + /usr/local/bin/server-brave-search --help >/dev/null; \ + # 정리 + npm cache clean --force; \ + apt-get purge -y gnupg; \ + apt-get autoremove -y --purge; \ + rm -rf /var/lib/apt/lists/* # jar 복사 COPY --from=builder /build/cs25-service/build/libs/*.jar app.jar diff --git a/cs25-service/src/main/resources/application.properties b/cs25-service/src/main/resources/application.properties index eed4922b..5cc8fa9c 100644 --- a/cs25-service/src/main/resources/application.properties +++ b/cs25-service/src/main/resources/application.properties @@ -72,7 +72,6 @@ spring.ai.mcp.client.stdio.connections.brave.command=server-brave-search spring.ai.mcp.client.stdio.connections.brave.args[0]=--transport spring.ai.mcp.client.stdio.connections.brave.args[1]=stdio spring.ai.mcp.client.stdio.connections.brave.env.BRAVE_API_KEY=${BRAVE_API_KEY} -spring.ai.mcp.client.initialized=false spring.autoconfigure.exclude=org.springframework.ai.model.tool.autoconfigure.ToolCallingAutoConfiguration #MAIL spring.mail.host=smtp.gmail.com