集成Github,Jenkins和Docker(在Docker中运行容器)

This article contains how Jenkins makes the project automate for the developer from writing the code to deployment just by assigning the jobs.

本文包含Jenkins如何使开发人员从分配代码到部署仅通过分配作业就使开发人员自动化。

Task :-

任务:-

  • Use the docker file to build the container with the customized image having Jenkins installed .

    使用docker文件构建安装有Jenkins的自定义映像的容器。
  • Jenkins should automatically Start as soon as the image is successfully launched.

    映像成功启动后,Jenkins应该自动启动。
  • Now we have assign the jobs to the Jenkins and create a chain of the jobs using pipeline plugins.

    现在,我们已将作业分配给Jenkins,并使用管道插件创建了一系列作业。

Now, we are going to create the file with name DOCKERFILE having the following commands:

现在,我们将使用以下命令创建名称为DOCKERFILE的文件:

Image for post
DOCKERFILE
DOCKERFILE

Now we will use our VM and run the command :

现在,我们将使用我们的VM并运行以下命令:

Image for post
DOCKER FILE USING CLI
使用CLI的DOCKER文件
Image for post

Jenkins project performs a full test flow with the following JDK/JREs:

Jenkins项目使用以下JDK / JRE执行完整的测试流程:

OpenJDK JDK / JRE 8 - 64 bits

OpenJDK JDK / JRE 8-64位

OpenJDK JDK / JRE 11 - 64 bits

OpenJDK JDK / JRE 11-64位

Using the cmd : docker image

使用cmd:docker映像

To check the status that the image is active or not

检查图像是否处于活动状态

Image for post

Now , logging in Jenkins in browser

现在,在浏览器中登录Jenkins

Image for post
LOGIN USING USERNAME AND PASSWORD
使用用户名和密码登录

JOB 1:- Automatically pulling the repo from GitHub whenever the developer push the repo using ssh plugins.

工作1 :-每当开发人员使用ssh插件推送仓库时,都会自动从GitHub中提取仓库。

> After successfully logging in to jenkins we have to install GitHub plugin .

>成功登录jenkins之后,我们必须安装GitHub插件。

> Then we have to provide the GitHub URL to fetch data.

>然后,我们必须提供GitHub URL来获取数据。

JOB2:- By looking at the code or program file , jenkins should automatically start the respective language interpreter install image container to deploy code.

JOB2 :-通过查看代码或程序文件,jenkins应该自动启动相应的语言解释器安装映像容器以部署代码。

Image for post
USING THIS CODE JENKINS INSTALL THE CONTAINER TO DEPLOY THE CODE OF DEVELOPER
使用此代码詹金斯安装容器以部署开发人员代码
Image for post

JOB3:- Testing the app if it is working or not .

JOB3 :-测试应用程序是否正常运行。

Image for post

JOB4:- Check if the app is not working , then send email to developer with error messages.We created a python file and if this site wont work or face any error ,it will run and developer will receive any email.

JOB4 :-检查应用程序是否无法正常运行,然后将错误消息发送给开发人员。我们创建了一个python文件,如果此网站无法正常工作或遇到任何错误,它将运行,开发人员将收到任何电子邮件。

>import smtplib

>进口smtplib

>server = smtplib.SMTP_SSL(“smtp.gmail.com”,465)

>服务器= smtplib.SMTP_SSL(“ smtp.gmail.com”,465)

>server.login = (mltask2@gmail.com,******)

> server.login =(mltask2@gmail.com,******)

>server.sendmail(“rohitkumawat1968@gmail.com”,

> server.sendmail(“ rohitkumawat1968@gmail.com”,

your site is not working)

您的网站无法正常工作)

>server.quit()

> server.quit()

This is the full automation of the php server using GitHub, Jenkins, and Docker.

这是使用GitHub,Jenkins和Docker的php服务器的完全自动化。

Thank u…!!

感谢你…!!

翻译自: https://medium.com/@rohitkumawat1968/integrating-github-jenkins-and-docker-running-a-container-in-docker-37f9341d82ca

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值