-
[Jenkins] Docker로 설치된 jenkins에 react 프로젝트 빌드를 위해 nodejs, npm, yarn 설치CICD 2022. 2. 10. 11:48
빌드 서버에 Jenkins를 Docker로 띄워서 사용 하던 중에 Jenkins Docker image가 완전히 날아갔다. 불행히도 백업을 해두지 않아서 기존에 사용하던 Jenkins 버전도 몰라서 기존의 볼륨 마운트해서 사용하던 jenkins_home 폴더에 최신 Jenkinks 버전 (2.333)을 받아서 재설치 하였다.
Jenkins에는 Nodejs 플러그인도 있지만 기존 Jenkins 프로젝트에서 Excute shell 에서 yarn 명령어를 통해서 React 프로젝트를 빌드해 주었기 때문에 Jenkins Docker image에 nodejs, npm, yarn을 설치해 주어야 했다. Execute shell 에서 실행되는 명령어는 Docker image 안에서 실행되는 shell script라고 생각하면 된다. 따라서 shell 에 nodejs가 설치되어 있지 않으면 jenkins plugin이 설치 되어 있더라도 shell로 React 프로젝트 빌드가 안된다.
Public DockerHub에 올라와 있는 Jenkins 이미지 (https://hub.docker.com/_/jenkins) 는 Debian OS를 기반으로 하기 때문에 Debian OS 기준으로 nodejs, npm, yarn을 설치하는 방법을 소개한다.
Nodejs 설치 (Root 권한)
curl -sL https://deb.nodesource.com/setup_lts.x | bash - apt-get install -y nodejs
NPM
apt-get install -y build-essential
Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list apt-get update && apt-get install yarn -y
'CICD' 카테고리의 다른 글
[Jenkins] Jenkins에서 React 빌드 에러: gyp verb check python checking for Python executable "python" in the PATH (0) 2022.02.10 [Jenkins] gitlab authentication error: fatal: Authentication failed for http://~ (0) 2022.02.10 Tomcat 에 Spring - Tibero 올리기 (0) 2021.11.22 [Jenkins] 젠킨스에서 sshpass, scp로 파일 전송에서 권한 오류가 날 때 (0) 2021.09.29 [Jenkins] 업데이트 후 가운데 정렬 문제 (0) 2021.09.14