本文参考自: 原文地址
一、安装jenkins
参考 https://store.docker.com/images/jenkins 进行安装
docker cp 容器id:容器内文件 宿主主机目录 可以拷贝那个key出来(jenkins容器里没有vi 安装vi比较麻烦不如拷贝文件出来方便)
二、安装插件
1.Maven Integration plugin
2.docker-build-step
3.Git plugin 、Git client plugin、 GIT server Plugin
三、jenkins设置
1.设置:Docker server REST API URL
系统管理->系统设置 找到 Docker Builder
我的系统是centos7
1.vim /usr/lib/systemd/system/docker.service
2.直接在ExecStart=/usr/bin/dockerd 后添加 -H=0.0.0.0:6732 -H=unix:///var/run/docker.sock
3.执行如下两个命令
systemctl daemon-reload
systemctl restart docker
jenkins和springboot项目部署在在同一个主机上,我用的ip是私有IP,这样docker 生成镜像时要快些
2.设置Maven
系统管理->Global Tool Configuration
四、新建项目
1.新建一个maven项目
2.源码管理
3.构建触发器
我的是gitlab 上面那个地址填在:你那git服务器的web hooks上,当代码提交到git上jenkins就会开始build
4.设置Build
5.设置Post Steps
6.保存
五、测试
点击 立即构建
或者提交新的git
点击上面#65 查看Console Output
-
BeanPostProcessors (for example: not eligible for auto-proxying)
-
-
. ____ _ __ _ _
-
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
-
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
-
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
-
' |____| .__|_| |_|_| |_\__, | / / / /
-
=========|_|==============|___/=/_/_/_/
-
:: Spring Boot :: (v1.5.2.RELEASE)
-
-
2017-08-16 10:06:02.758 INFO 6589 --- [ main] com.dcssn.WeianApplicationTests : No active profile set, falling back to default profiles: default
-
2017-08-16 10:06:02.762 INFO 6589 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Refreshing org.springframework.web.context.support.GenericWebApplicationContext@64711bf2: startup date [Wed Aug 16 10:06:02 UTC 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@f1da57d
-
-
2017-08-16 10:06:04.141 INFO 6589 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
-
-
2017-08-16 10:06:05.171 INFO 6589 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
-
2017-08-16 10:06:05.263 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.ProductRepository.
-
2017-08-16 10:06:05.265 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.DepartmentRepository.
-
2017-08-16 10:06:05.266 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.FlinkRepository.
-
2017-08-16 10:06:05.266 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.NewsRepository.
-
2017-08-16 10:06:05.267 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.TypeRepository.
-
-
2017-08-16 10:06:05.280 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.UserRepository.
-
2017-08-16 10:06:05.281 INFO 6589 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.dcssn.repository.RoleRepository.
-
2017-08-16 10:06:05.412 WARN 6589 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
-
2017-08-16 10:06:05.854 INFO 6589 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=621c2cec-3059-3fd9-9e49-4656ed1a82ee
-
2017-08-16 10:06:06.152 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaConfiguration' of type [com.dcssn.config.JpaConfiguration$$EnhancerBySpringCGLIB$$62f44bbb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
-
-
2017-08-16 10:06:06.357 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$85f2e13b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
-
2017-08-16 10:06:06.697 INFO 6589 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a20ce438] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
-
-
2017-08-16 10:06:08.030 INFO 6589 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
-
2017-08-16 10:06:08.159 INFO 6589 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
-
2017-08-16 10:06:08.195 INFO 6589 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
-
name: default
-
...]
-
2017-08-16 10:06:08.337 INFO 6589 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
-
2017-08-16 10:06:08.338 INFO 6589 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
-
2017-08-16 10:06:08.340 INFO 6589 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
-
2017-08-16 10:06:08.410 INFO 6589 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
-
-
2017-08-16 10:06:08.647 INFO 6589 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
-
-
2017-08-16 10:06:09.834 INFO 6589 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
-
2017-08-16 10:06:10.444 INFO 6589 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
-
-
2017-08-16 10:06:11.578 INFO 6589 --- [ main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
-
-
Hibernate: select role0_.id as id1_5_, role0_.name as name2_5_, role0_.url as url3_5_ from role role0_
-
-
2017-08-16 10:06:15.152 INFO 6589 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@4bf89d3d, org.springframework.se