pipeline을 이용한 app 배포

2023. 10. 19. 15:31docker

참고 사이트

https://www.jenkins.io/blog/2017/02/07/declarative-maven-project/

 

Declarative Pipeline for Maven Projects

The next thing we’ll add in this Pipeline is a tools section to let us use Maven. The tools section is one of several sections we can add under pipeline, which affect the configuration of the rest of the Pipeline. (We’ll look at the others, including a

www.jenkins.io

 

 

script
pipeline {
    agent any
    tools { 
      maven 'maven3.9.5'
    }
    stages {
        stage('github clone') {
            steps {
                git branch: 'main', url: 'https://github.com/manupul/hello' 
            }
        }
        
        stage('build') {
            steps {
                sh '''
                    echo build start
                    mvn clean compile package -DskipTests=true
                '''
            }
        }
    }
}

 

 

windows tomcat에 app 배포

새 프로젝트 생성

 

 

설명 기입

 

 

빨간 박스 내용 추가

 

 

Pipeline Syntax에서 배포에 대한 내용 입력

 

 

파란 박스 클릭 후 내용 복사

 

 

복사한 내용 붙여넣기

 

 

빌드 성공!

 

 

배포 확인

 

 

실제 디렉토리 확인

 

 

docker-server2에 image 빌드

SSH에 docker-server2 추가

 

 

12project에 script에서 빨간 박스 부분 추가

 

 

Pipeline Syntax에서 빌드에 대한 내용 입력

 

 

수행 명령어 'docker build -t jingukang/jenkins_docker_pipeline -f Dockerfile .'까지 모두 입력

 

 

파란 박스를 클릭해서 내용 복사

 

 

복사한 내용 붙여넣기

 

 

빌드 완료

 

 

docker-server2에서 이미지 확인

 

 

트러블 슈팅

Maven의 이름과 매칭이 되지 않아 생기는 오류메시지

 

 

자신이 지정한 이름을 확인

 

 

수정하면 오류 해결

'docker' 카테고리의 다른 글

pipe-line 연습문제  (0) 2023.10.19
pipeline-view  (0) 2023.10.19
Docker hub를 이용한 container 생성  (0) 2023.10.18
ansible 내 tomcat SCM  (0) 2023.10.18
Ansible-server에 tomcat 생성  (1) 2023.10.17