본문 바로가기

카카오테크 부트캠프

[KTB]젠킨스를 사용해 CI/CD - 인스턴스 용량 없음 이슈

Started by user admin
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/trippop-frontend
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] git
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/trippop-frontend/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/KTB-15/TripPopFrontend.git # timeout=10
Fetching upstream changes from https://github.com/KTB-15/TripPopFrontend.git
 > git --version # timeout=10
 > git --version # 'git version 2.43.0'
 > git fetch --tags --force --progress -- https://github.com/KTB-15/TripPopFrontend.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/feature/dockerfile^{commit} # timeout=10
Checking out Revision 40d07ebbdfd673842f8097217af14a0620daba57 (refs/remotes/origin/feature/dockerfile)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 40d07ebbdfd673842f8097217af14a0620daba57 # timeout=10
 > git branch -a -v --no-abbrev # timeout=10
 > git branch -D feature/dockerfile # timeout=10
 > git checkout -b feature/dockerfile 40d07ebbdfd673842f8097217af14a0620daba57 # timeout=10
Commit message: "add : dockerfile"
 > git rev-list --no-walk 40d07ebbdfd673842f8097217af14a0620daba57 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build Docker Image)
[Pipeline] script
[Pipeline] {
[Pipeline] isUnix
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ docker build -t 864899843417.dkr.ecr.ap-northeast-2.amazonaws.com/trippopfrontend:latest .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon   2.25MB

Step 1/6 : FROM node:20 AS build
20: Pulling from library/node
903681d87777: Pulling fs layer
3cbbe86a28c2: Pulling fs layer
6ed93aa58a52: Pulling fs layer
787c78da4383: Pulling fs layer
7203e46f2829: Pulling fs layer
ce4d5ef2f711: Pulling fs layer
488bbe69ac4a: Pulling fs layer
51c5b7ece801: Pulling fs layer
787c78da4383: Waiting
7203e46f2829: Waiting
ce4d5ef2f711: Waiting
488bbe69ac4a: Waiting
51c5b7ece801: Waiting
3cbbe86a28c2: Verifying Checksum
3cbbe86a28c2: Download complete
903681d87777: Verifying Checksum
903681d87777: Download complete
6ed93aa58a52: Verifying Checksum
6ed93aa58a52: Download complete
7203e46f2829: Verifying Checksum
7203e46f2829: Download complete
488bbe69ac4a: Verifying Checksum
488bbe69ac4a: Download complete
ce4d5ef2f711: Verifying Checksum
ce4d5ef2f711: Download complete
51c5b7ece801: Verifying Checksum
51c5b7ece801: Download complete
787c78da4383: Verifying Checksum
787c78da4383: Download complete
903681d87777: Pull complete
3cbbe86a28c2: Pull complete
6ed93aa58a52: Pull complete
787c78da4383: Pull complete
7203e46f2829: Pull complete
ce4d5ef2f711: Pull complete
488bbe69ac4a: Pull complete
51c5b7ece801: Pull complete
Digest: sha256:a4d1de4c7339eabcf78a90137dfd551b798829e3ef3e399e0036ac454afa1291
Status: Downloaded newer image for node:20
 ---> 7ff5292d4419
Step 2/6 : WORKDIR /app
 ---> Running in c8f853cc31a0
Removing intermediate container c8f853cc31a0
 ---> af32af1c2c4f
Step 3/6 : COPY package.json yarn.lock ./
 ---> 1eec04eb5de6
Step 4/6 : RUN yarn install
 ---> Running in d6b163fd0034
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > eslint-plugin-react-hooks@4.6.2" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0".
[4/4] Building fresh packages...
Done in 27.39s.
write /usr/local/share/.cache/yarn/v6/npm-@swc-core-linux-x64-musl-1.7.5-f9cdaf34ef6f32c495438e48e98b244f563387aa-integrity/node_modules/@swc/core-linux-x64-musl/.yarn-tarball.tgz: no space left on device
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Push to ECR)
Stage "Push to ECR" skipped due to earlier failure(s)
[Pipeline] getContext
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

어라라 이런. 오류가 나서 원인을 살폈더니... 용량 부족이란다. 근데 인스턴스엔 뭘 저장한적없고 초반 젠킨스와 도커, 자바만 설정했는데..!!!

 

바로 볼륨 문제때문이었습니다~ 

젠킨스와 도커, 자바를 설치해서 그 설치분만해도 용량이 너무너무 많았나봐요 

 

EC2 볼륨에 들어가서 수정을 눌러 볼륨을 12기가로 늘려줬습니다

 

그리고 터미널에 가서 설정으 ㄹ완료해야돼요!!

lsblk명령어를 사용하면 nvme0n1이 12G로 잘 바뀐걸 볼 수 있습니다

 

nvme0n1은 실제 사용중인 루트 디렉토리입니다

 

sudo resize2fs /dev/nvme0n1p1

이 명령어를 이용하면 적용이 되어야 하는데

실제 파일 용량을 확인하면 12보다 턱없이 적죠...? 적용이 안됐습니다.

 

지피티에게 물어본 결과

sudo apt-get update
sudo apt-get install cloud-guest-utils
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1

이 명령어를 쳐줍니다! 설명을 하자면

여기 파티션이 nvme0n1p1에 /로 되어있어서 그렇다네요 그래서 파티션을 다시 해주는 명령어입니다!!

용량은 해결 오나료~!~! 과연 젠킨스가 될 지...

 

 

 

yarn dev사용

포트번호 충돌이슈가이썽ㅆ는데....지피티가  잘 해줍니다 이건! 

도커파일 수정완

 

FROM node:20 AS build
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . ./
RUN yarn build
CMD ["yarn", "dev", "--host", "--port", "5173"]

해서 완료~!~!~!~!