docker compose启动
使用docker快速启动一个jenkins+gitea实现cicd,方便又快捷
启动后访问8081初始化gitea,访问jenkins初始化jenkins即可
只给出了基本的启动配置,具体的gitea对接到jenkins没空写,感兴趣的可以留言,人多的话可以更新一期完整的配置
jenkins和gitea的compose.yaml
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins:2.462.3-lts
restart: always
privileged: true
user: root
ports:
- 8080:8080
volumes:
- ./jenkins_data:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/bin/docker
- /etc/localtime:/etc/localtime:ro
gitea:
image: commitgo/gitea-ee:22.3.1
container_name: gitea
hostname: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=mysql57:3306
- GITEA__database__NAME=gitea_data
- GITEA__database__USER=root
- GITEA__database__PASSWD=000000
restart: always
volumes:
- ./gitea_data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 8081:3000
- 22222:22
mysql57:
hostname: mysql57
container_name: mysql57
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: "000000"
ports:
- "3306:3306"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mysql_data:/var/lib/mysql
启动Jenkins容器后首次查看Jenkins密码
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword
效果图,如果有人想看的话,我有空出一期详细配置
gitea
jenkins
流水线运行
部署一个课设项目基于maven+springboot的,用jenkins+gitea+docker实现