본문 바로가기

프로젝트 & TIL/일별 공부 기록 (백엔드 스쿨)

64일차 - 젠킨스 설치, 파이프라인 프로젝트, 프로토타이핑 툴

젠킨스 설치

8081 포트 사용

docker run \
  --name jenkins_1 \
  -p 8081:8080 \
  -e TZ=Asia/Seoul \
  -v /docker_projects/jenkins_1/var/jenkins_home:/var/jenkins_home \ # 볼륨 설정
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /docker_projects/jenkins_1/data:/data \
  -u root \
  -d \
  --restart unless-stopped \
  jenkins/jenkins:jdk17

  

npm으로 proxy 처리

jenkins.나의 url / 172.17.0.1 / 8081 포트 / SSL

  

jenkins 접속

jenkins.나의 url

초기 비밀번호 확인 : docker exec jenkins_1 cat /var/jenkins_home/secrets/initialAdminPassword

  

jenkins 사용자 생성

- Username: admin

- Password: 비밀번호

- Confirm password: 비밀번호

- Full name: admin

- E-mail address: 내_이메일_주소

 


파이프라인 프로젝트 생성

새로운 Item 클릭


Pipeline 선택 > item name 입력 > OK

  

  


파이프라인 스크립트 입력

pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                git branch: 'main', url: '내_깃허브_주소'
            }
        }
    }
}

  

branch는 main

 


파이프라인 빌드

'지금 빌드' 클릭


* jenkins 파이프라인 이름이 syr_1 일 경우

docker exec jenkins_1 ls -alh /var/jenkins_home/workspace/syr_1

=> 컨테이너에 직접 접속해서 탐색

ls -alh /docker_projects/jenkins_1/var/jenkins_home/workspace/syr_1

=> 젠킨스 설치할 때 설정한 볼륨을 이용한 탐색

  

docker run \
  
  ...
  
  -v /docker_projects/jenkins_1/var/jenkins_home:/var/jenkins_home \ # 볼륨 설정
  
  ...

깃허브 웹훅 추가

위에서 설정했던 내 리포지터리 > Settings > Webhooks > Add Webhook

Payload URL : https://jenkins.나의_URL/github-webhook/

  

  

jenkins > Configure > General > Build Triggers - GitHub hook ... 체크 하고 저장

  

  


git pull이 자동으로 되는지 확인하기

일단 디렉토리 삭제 : rm -rf /docker_projects/jenkins_1/var/jenkins_home/workspace/syr_1

main 브랜치에서 커밋 발생시킴

적용되었는지 확인 : ls -alh /docker_projects/jenkins_1/var/jenkins_home/workspace/syr_1


젠킨스 안에 도커 설치

젠킨스 bash 접속 : docker exec -it jenkins_1 bash

도커 설치

  

apt-get update -y
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
rm /etc/apt/keyrings/docker.gpg
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli docker-compose-plugin
exit

  

젠킨스 안의 소켓이 바깥쪽 도커 엔진을 가리킨다.

=> docker images, docker ps 명령어 입력 시 도커 호스트 기준에서 실행된다.

  

docker run \
  
  ...
  
  -v /var/run/docker.sock:/var/run/docker.sock \
  
  ...

  


프로토타이핑 툴

https://www.framer.com/

 

Framer — Design and ship your dream site. Zero code, maximum speed.

Design your website on a familiar canvas. Add animations, interactions and a CMS. Optimize for every breakpoint — no code needed and publish for free.

www.framer.com

https://www.figma.com/

 

Figma: the collaborative interface design tool.

Build better products as a team. Design, prototype, and gather feedback all in one place with Figma.

www.figma.com