2020年9月11日星期五

Introduction Of CI/CD workflow on Node Application


WORKFLOW
  1. SOURCE DOWNLOAD FROM GITHUB ( git clone URL)
  2. UPDATE SOURCE AND GIT COMMIT  (git commit -m "comment")
  3. BUILD SOURCE BY JENKINS 
  4. BUILD DOCKER IMAGES BY DOCKER BUILD
  5. DEPLOY DOCKER IMAGE 

 1. Download/Upload source from git 

git clone https://github.com/lqwangxg/vuechat 
git commit -m "comment"
git push -u origin master 

 2. Docker pull Jenkins  and run Jenkins

docker pull jenkins/jenkins 

docker run -dp 8080:8080 -p 50000:50000 --name jenkins \
 -v jenkins_home:/var/jenkins_home jenkins/jenkins
/var/jenkins_home/secrets/initialAdminPassword

# play with docker: 
#cat /var/lib/docker/volumes/jenkins_home/_data/secrets/initialAdminPassword

 3. Config Jenkins 




#1 Jenkins system configuration
    install build tool plugins like github, nodejs, docker
#2 project configuration
  setting username password for logining to respository
#3 action before and after building.
  - git fetch from git repository
  - npm install 
  - npm run build 
  - docker build -tag imagename -f Dockerfile.deploy  .
  - docker run  -d -p 8080:8080 imagename 

没有评论: