chore: 런타임베이스이미지를 Ubuntu 계열로 변경하여 apt-get 명령어가 동작할 수 있게 변경#369
chore: 런타임베이스이미지를 Ubuntu 계열로 변경하여 apt-get 명령어가 동작할 수 있게 변경#369wannabeing merged 1 commit intodevfrom
Conversation
Walkthroughcs25-service/Dockerfile 변경: 베이스 이미지를 eclipse-temurin:17-jre-jammy로 교체하고, Node.js 설치 절차를 정리·최적화했으며, EXPOSE 8080과 ENTRYPOINT ["java","-jar","/apps/app.jar"]를 추가해 컨테이너 포트와 시작 명령을 명시했습니다. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 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 comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
cs25-service/Dockerfile (1)
43-43: ENTRYPOINT 적절합니다만, Non-root 실행과 HEALTHCHECK를 함께 고려하세요
- 보안(필수 권장): 컨테이너를 비루트 사용자로 실행해 권한을 최소화하세요.
- 운영(선택): Spring Boot actuator를 사용 중이라면 HEALTHCHECK를 추가해 오케스트레이터가 상태를 판단할 수 있게 하세요.
예시(파일 내 추가 코드, 위치는 COPY 이후 ENTRYPOINT 이전):
# 비루트 사용자 생성 및 권한 부여 RUN groupadd -r app && useradd -r -g app app \ && chown -R app:app /apps USER app # (선택) 헬스체크 - actuator 사용 시 # HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \ # CMD curl -fsS http://localhost:8080/actuator/health || exit 1또한(선택), 메모리 제한 환경에서의 안정성을 위해 JAVA 옵션을 환경변수로 선언하는 것도 도움이 됩니다.
예:ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75.0 -XX:+UseContainerSupport"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
cs25-service/Dockerfile(2 hunks)
🔇 Additional comments (2)
cs25-service/Dockerfile (2)
15-15: Ubuntu 계열로의 베이스 이미지 전환 적절합니다apt-get 사용 이슈를 해결하는 방향으로 합리적입니다. 런타임은 JRE 이미지로 경량화된 점도 좋습니다.
40-40: EXPOSE 8080 명시 좋습니다런타임 포트 명시로 운영/오케스트레이션 설정 가독성이 좋아집니다.
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends curl ca-certificates gnupg bash \ | ||
| && 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 \ | ||
| && npm cache clean --force \ | ||
| && apt-get purge -y gnupg \ | ||
| && apt-get autoremove -y --purge \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Node 설치 RUN 체인의 신뢰성/재현성/보안 개선 제안
현재 파이프(curl | bash)는 실패 전파가 약하고(기본 쉘에서 pipefail 미설정 시) 재현성(버전 고정 부재)도 떨어집니다. 아래 개선을 권장합니다.
- 신뢰성:
set -eux로 즉시 실패, 파이프 회피(스크립트 파일로 저장 후 실행). - 재현성: Node/글로벌 npm 패키지 버전을 고정.
- 보안/최소권한: 글로벌 패키지 설치는 유지하되 가능하면 Non-root 사용자로 실행(아래 별도 코멘트).
- 정리: 임시 파일 삭제, apt 리스트/캐시 정리(이미 잘 하고 계시나,
apt-get clean은 선택 사항).
적용 예시(diff):
-RUN apt-get update \
- && apt-get install -y --no-install-recommends curl ca-certificates gnupg bash \
- && 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 \
- && npm cache clean --force \
- && apt-get purge -y gnupg \
- && apt-get autoremove -y --purge \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
+RUN set -eux; \
+ apt-get update && \
+ apt-get install -y --no-install-recommends curl ca-certificates gnupg bash && \
+ curl -fsSL -o /tmp/nodesource_setup.sh https://deb.nodesource.com/setup_20.x && \
+ bash /tmp/nodesource_setup.sh && \
+ apt-get install -y --no-install-recommends nodejs && \
+ npm install -g @modelcontextprotocol/server-brave-search@<고정버전> && \
+ npm cache clean --force && \
+ apt-get purge -y --auto-remove gnupg && \
+ rm -rf /var/lib/apt/lists/* /tmp/nodesource_setup.sh추가로(선택): Nodesource의 공식 keyring(signed-by) 방식으로 더 명시적으로 핀ning 할 수도 있습니다. 필요하시면 해당 방식으로도 패치 제안 드리겠습니다.
아래 명령으로 기본 동작을 빠르게 확인해 보세요(지역 환경/CI 에서 실행).
🏁 Script executed:
#!/bin/bash
set -euxo pipefail
# 이미지 빌드
docker build -t cs25-service:test -f cs25-service/Dockerfile .
# apt/node/npm, 글로벌 패키지 확인
docker run --rm cs25-service:test bash -lc 'apt-get --version && node -v && npm -v && command -v mcp-brave-search-server'Length of output: 182
🏁 Script executed:
#!/bin/bash
set -eux
# 출력: RUN 체인 부분 확인
rg -n "RUN apt-get update" -A15 cs25-service/Dockerfile
# 파이프된 스크립트 사용 여부 확인
rg -n "curl -fsSL .*\\| bash" -n cs25-service/Dockerfile
# 글로벌 패키지 버전 고정 여부 확인
rg -n "@modelcontextprotocol/server-brave-search" -n cs25-service/Dockerfile
# set -euxo pipefail 설정 여부 확인
rg -n "set .*pipefail" -n cs25-service/Dockerfile || echo "No pipefail setting found"Length of output: 1030
Dockerfile RUN 체인에서 실패 전파·재현성·보안 개선 필요
아래 사항을 반영해 Dockerfile의 24–33라인 RUN 체인을 개선해주세요.
- 실패 전파:
set -euxo pipefail추가 → 중간 단계 실패 시 즉시 종료 - 스크립트 파이프 회피:
curl … | bash대신 다운로드 후 실행 - 버전 고정: 글로벌 npm 패키지(
@modelcontextprotocol/server-brave-search)에 명시적 버전 지정 - 임시 파일·불필요 패키지 정리:
--auto-remove,/tmp파일 삭제 포함
— 수정 대상
• 파일: cs25-service/Dockerfile
• 라인: 24–33
— 예시 diff
-RUN apt-get update \
- && apt-get install -y --no-install-recommends curl ca-certificates gnupg bash \
- && 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 \
- && npm cache clean --force \
- && apt-get purge -y gnupg \
- && apt-get autoremove -y --purge \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
+RUN set -euxo pipefail; \
+ apt-get update && \
+ apt-get install -y --no-install-recommends curl ca-certificates gnupg bash && \
+ curl -fsSL -o /tmp/nodesource_setup.sh https://deb.nodesource.com/setup_20.x && \
+ bash /tmp/nodesource_setup.sh && \
+ apt-get install -y --no-install-recommends nodejs && \
+ npm install -g @modelcontextprotocol/server-brave-search@<고정버전> && \
+ npm cache clean --force && \
+ apt-get purge -y --auto-remove gnupg && \
+ rm -rf /var/lib/apt/lists/* /tmp/nodesource_setup.sh추가로
- 필요 시 Nodesource 공식 keyring(
signed-by) 방식으로 GPG 인증 핀닝 적용 고려 - 글로벌 설치 전용 Non-root 사용자 전환도 검토해주세요
📝 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.
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends curl ca-certificates gnupg bash \ | |
| && 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 \ | |
| && npm cache clean --force \ | |
| && apt-get purge -y gnupg \ | |
| && apt-get autoremove -y --purge \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN set -euxo pipefail; \ | |
| apt-get update && \ | |
| apt-get install -y --no-install-recommends curl ca-certificates gnupg bash && \ | |
| curl -fsSL -o /tmp/nodesource_setup.sh https://deb.nodesource.com/setup_20.x && \ | |
| bash /tmp/nodesource_setup.sh && \ | |
| apt-get install -y --no-install-recommends nodejs && \ | |
| npm install -g @modelcontextprotocol/server-brave-search@<고정버전> && \ | |
| npm cache clean --force && \ | |
| apt-get purge -y --auto-remove gnupg && \ | |
| rm -rf /var/lib/apt/lists/* /tmp/nodesource_setup.sh |
🤖 Prompt for AI Agents
In cs25-service/Dockerfile around lines 24 to 33, the RUN chain must be hardened
for failure propagation, reproducibility and security: prepend a shell safety
header (set -euxo pipefail) to the RUN, replace the curl | bash pattern by
downloading the NodeSource setup script to a temporary file, verify/execute it
explicitly (or prefer the signed-by keyring method to add the NodeSource apt
repo), then install nodejs; install @modelcontextprotocol/server-brave-search
with an explicit pinned version (e.g.
@modelcontextprotocol/server-brave-search@x.y.z) rather than latest; use apt-get
install with --no-install-recommends and --auto-remove where appropriate and
purge unnecessary packages in the same RUN, clean apt lists, remove /tmp and any
downloaded setup script, and clear npm cache; optionally switch to a non-root
user before the global npm install if global install is required for runtime.
* chore: MCP 도입할 때 필요한 npx 패키지 적용 (#367) * chore: MCP 도입할 때 필요한 npx 패키지 적용 * chore: 부팅 시 외부 프로세스 미실행 (요청 시 연결) * chore: 런타임베이스이미지를 Ubuntu 계열로 변경하여 apt-get 명령어가 동작할 수 있게 변경 (#369) --------- Co-authored-by: Ksr-ccb <harang4282@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: baegjonghyeon <baek011226@naver.com> Co-authored-by: Baek jonghyun <69610809+jong-0126@users.noreply.github.com> Co-authored-by: crocusia <132359536+crocusia@users.noreply.github.com> Co-authored-by: Kimyoonbeom <101162650+Kimyoonbeom@users.noreply.github.com> Co-authored-by: HeeMang-Lee <hemsej018@naver.com> Co-authored-by: Kimyoonbeom <kimybeom@naver.com> Co-authored-by: crocusia <rainbowsubin0522@gmail.com>
🔎 작업 내용
openjdk-17→ Ubuntu 계열(eclipse-temurin:17-jre-jammy)로 변경런타임 베이스 이미지?
🧩 트러블 슈팅
배포 시, apt-get 명령어를 못찾겠다는 예외 발생
🧯 해결해야 할 문제
UserController에서 비즈니스 로직 일부 처리 → 서비스로 이전 고려 필요📌 참고 사항
🙏 코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit