00:00:00
加载中...
若依项目集成gitee配置Jenkins拉取代码到harbor仓库业务K8S容器化
本文最后更新于170 天前,其中的信息可能已经过时,如有错误请发送邮件到big_fw@foxmail.com

1创建gitee仓库

2仓库初始化

[root@habor250.oldboyedu.com ~]# mkdir oldboyedu-linux102-ruoyi

[root@habor250.oldboyedu.com ~]# cd oldboyedu-linux102-ruoyi/

[root@habor250.oldboyedu.com oldboyedu-linux102-ruoyi]# git init

hint: Using ‘master’ as the name for the initial branch. This default branch

name

hint: is subject to change. To configure the initial branch name to use in all

hint: of your new repositories, which will suppress this warning, call:

hint:

hint: git config –global init.defaultBranch <name>

hint:

hint: Names commonly chosen instead of ‘master’ are ‘main’, ‘trunk’ and

hint: ‘development’. The just-created branch can be renamed via this command:

hint:

hint: git branch -m <name>

3复制若依代码到仓库

[root@elk91 RuoYi-Vue]# scp -r ./* 10.0.0.250:/root/oldboyedu-linux102-ruoyi

4编写Dockerfile

4.1后端Dockerfile

[root@jenkins211 oldboyedu-linux102-ruoyi]# cat Dockerfile

FROM harbor250.oldboyedu.com/oldboyedu-devops/tomcat:9.0-jre21

MAINTAINER cutegou

LABEL school=linux102

COPY ruoyi-admin/target/ruoyi-admin.jar /usr/local/tomcat/

EXPOSE 8080

CMD [“java”,”-jar”,”ruoyi-admin.jar”]

4.2前端Dockerfile

[root@jenkins211 oldboyedu-linux102-ruoyi]# cat ruoyi-ui/Dockerfile

FROM registry.cn-hangzhou.aliyuncs.com/yinzhengjie-k8s/apps:v1

MAINTAINER cutegou

LABEL school=linux102

EXPOSE 80

RUN rm -rf /usr/share/nginx/html/*

WORKDIR /usr/share/nginx/html/

COPY dist/ /usr/share/nginx/html

COPY nginx.conf /etc/nginx/nginx.conf

5提交代码到gitee仓库

[root@habor250.oldboyedu.com oldboyedu-linux102-ruoyi]# git add .

[root@habor250.oldboyedu.com oldboyedu-linux102-ruoyi]# git commit -m ‘ruoyi-

test’

[master (root-commit) fa4466f] ruoyi-test

989 files changed, 78656 insertions(+)

create mode 100644 Dockerfile

create mode 100644 LICENSE

create mode 100644 README.md

create mode 100644 bin/clean.bat

[root@habor250.oldboyedu.com oldboyedu-linux102-ruoyi]# git remote add origin

6JenKins配置

6Jenkins环境配置

6.1mvn环境配置

[root@jenkins211 ~]# wget

http://192.168.14.253/Resources/Docker/Projects/RuoYi/apache-maven-3.9.14-

bin.tar.gz

–2026-04-22 20:25:44–

http://192.168.14.253/Resources/Docker/Projects/RuoYi/apache-maven-3.9.14-

bin.tar.gz

Connecting to 192.168.14.253:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 9238692 (8.8M) [application/octet-stream]

Saving to: ‘apache-maven-3.9.14-bin.tar.gz’

apache-maven-3.9.14-bin.tar.gz                       100%

[===============================================================================

======>]   8.81M  –.-KB/s    in 0.08s  

2024-04-22 20:25:44 (114 MB/s) – ‘apache-maven-3.9.14-bin.tar.gz’ saved

[9238692/9238692]

[root@jenkins211 ~]# tar xf apache-maven-3.9.14-bin.tar.gz -C /usr/local/

[root@jenkins211 ~]# vim /etc/profile.d/maven.sh

#!/bin/bash

export MAVEN_HOME=/usr/local/apache-maven-3.9.14

export PATH=$PATH:$MAVEN_HOME/bin

“/etc/profile.d/maven.sh” [New] 4L, 96B written                                

[root@jenkins211 ~]# source /etc/profile.d/maven.sh

[root@jenkins211 ~]# mvn -v

Apache Maven 3.9.14 (996c630dbc656c76214ce58821dcc58be960875b)

Maven home: /usr/local/apache-maven-3.9.14

Java version: 17.0.8, vendor: Oracle Corporation, runtime: /usr/local/jdk-17.0.8

Default locale: en, platform encoding: UTF-8

OS name: “linux”, version: “5.15.0-161-generic”, arch: “amd64”, family: “unix”

6.2node环境

[root@jenkins211 ~]# wget

http://192.168.14.253/Resources/Docker/Projects/RuoYi/node-v24.14.1-linux-x64.tar.xz

–2024-04-22 20:27:44–

http://192.168.14.253/Resources/Docker/Projects/RuoYi/node-v24.14.1-linux-x64.tar.xz

Connecting to 192.168.14.253:80… connected.

HTTP request sent, awaiting response… 200 OK

Length: 31117676 (30M) [application/octet-stream]

Saving to: ‘node-v24.14.1-linux-x64.tar.xz’

node-v24.14.1-linux-x64.tar.xz                       100%

[===============================================================================

=====>]  29.68M   110MB/s    in 0.3s    

2024-04-22 20:27:44 (110 MB/s) – ‘node-v24.14.1-linux-x64.tar.xz’ saved

[31117676/31117676]

[root@jenkins211 ~]# tar xf node-v24.14.1-linux-x64.tar.xz -C /usr/local/

[root@jenkins211 ~]# vim /etc/profile.d/nodejs.sh

#!/bin/bash

export NODEJS_HOME=/usr/local/node-v24.14.1-linux-x64

export PATH=$PATH:$NODEJS_HOME/bin

“/etc/profile.d/nodejs.sh” [New] 4L, 102B written                                

[root@jenkins211 ~]# source /etc/profile.d/nodejs.sh

[root@jenkins211 ~]# node -v

v24.14.1

[root@jenkins211 oldboyedu-linux102-ruoyi]# ln -s /usr/local/node-v24.14.1-linux-x64/bin/node /usr/bin/node

[root@jenkins211 oldboyedu-linux102-ruoyi]# ln -s /usr/local/node-v24.14.1-linux-x64/bin/npm /usr/bin/npm

[root@jenkins211 oldboyedu-linux102-ruoyi]# ln -s /usr/local/node-v24.14.1-linux-x64/bin/npx /usr/bin/npx

7创建流水线任务

8配置参数化构建

9编写Pipeline script

10集成钉钉告警

配置钉钉pipeline script

文末附加内容
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇