当前位置: 首页 > news >正文

jenkins自动化构建docker镜像并上传至harbor仓库

1、插件下载

在这里插入图片描述
首先进入jenkins之后需要现在“Maven”、“GitLab”、“Jdk”、“SSH”、“Git”的相关插件,这里不再赘述,需要什么插件直接安装即可
在这里插入图片描述
搜索对应插件后选择直接安装即可

2、系统全局配置

2.1 Maven配置

在这里插入图片描述
配置maven安装的相应的setting文件
在这里插入图片描述
不知道具体目录的可以通过“mvn -v”之后的Maven home查看

vim /usr.local/apache-maven-3.9.6/conf/setting.xml

修改mirrors下的源地址,因为后面在jenkins中进行jar包打包的时候需要通过maven下载对应的依赖,使用默认maven仓库地址可能会导致失败

    <mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>--><!-- 阿里云仓库 --><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url></mirror><!-- 中央仓库1 --><mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url></mirror><!-- 中央仓库2 --><mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo2.maven.org/maven2/</url></mirror>

修改maven打包后jar包的java编译编译工具版本,原来setting.xml中的默认版本为jdk1.4,修改为17

    <profile><id>jdk-17</id><activation><jdk>17</jdk></activation><repositories><repository><id>jdk17</id><name>Repository for JDK 17 builds</name><url>http://www.myhost.com/maven/jdk17</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>

我的完整setting.xml如下,可参照

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user,|                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in|                 ${maven.conf}/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- TODO Since when can proxies be selected as depicted? --><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).|| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are|       used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><mirrors><!-- mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>--><!-- 阿里云仓库 --><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/repositories/central/</url></mirror><!-- 中央仓库1 --><mirror><id>repo1</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo1.maven.org/maven2/</url></mirror><!-- 中央仓库2 --><mirror><id>repo2</id><mirrorOf>central</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://repo2.maven.org/maven2/</url></mirror></mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is| dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact|       repositories, plugin repositories, and free-form properties to be used as configuration|       variables for plugins in the POM.||--><profiles><!-- profile| Specifies a set of introductions to the build process, to be activated using one or more of the| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>| or the command line, profiles have to have an ID that is unique.|| An encouraged best practice for profile identification is to use a consistent naming convention| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.| This will make it more intuitive to understand what the set of introduced profiles is attempting| to accomplish, particularly when you only have a list of profile id's for debug.|| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.<profile><id>jdk-17</id><activation><jdk>17</jdk></activation><repositories><repository><id>jdk17</id><name>Repository for JDK 17 builds</name><url>http://www.myhost.com/maven/jdk17</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><!--| Here is another profile, activated by the property 'target-env' with a value of 'dev', which| provides a specific path to the Tomcat instance. To use this, your plugin configuration might| hypothetically look like:|| ...| <plugin>|   <groupId>org.myco.myplugins</groupId>|   <artifactId>myplugin</artifactId>||   <configuration>|     <tomcatLocation>${tomcatPath}</tomcatLocation>|   </configuration>| </plugin>| ...|| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to|       anything, you could just leave off the <value/> inside the activation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

2.2 git下载

在jenkins中自动构建项目的时候,我们的第一步是从gitlab仓库中拉取我们的代码,所以必不可少需要进行git的安装
在这里插入图片描述
如果自动安装失败,需要修改jenkins的镜像文件

#进入配置文件
vim /etc/docker/daemon.json
# 在文件在最后,增添如下源地址
"registry-mirrors": ["https://docker.m.daocloud.io","https://dockerhub.icu","https://registry.aliyuncs.com","https://docker.nju.edu.cn"]
# 保存后退出
# 重启加载dokcer配置
systemctl reload daemon.json
# 重启docker容器使之生效
systemctl restart docker

如果还是安装失败,可自行百度“centos7系统安装git的教程”,安装过程较为简单,这里不再赘述

3、maven任务构建

我这里在gitlab中创建了一个非常基础的maven项目进行测试,所以构建了maven项目
在这里插入图片描述
如果你的界面中没有这个maven任务构建的选项,则说明你没有安装对应的maven插件,可在安装完对应maven插件后再继续进行。
构建任务的命名按自己的意向命名即可
在这里插入图片描述
构建完成任务后进入配置界面
在这里插入图片描述

3.1 重要配置描述

git配置

在这里插入图片描述
URL需要到安装的虚拟机中的gitlab项目中进行复制
在这里插入图片描述
第二步需要需要添加gitlab凭证,就是你登录部署gitlab这台虚拟机的账户和密码
在这里插入图片描述
在配置完全局凭证之后,就可以在任务中的凭证栏选择你刚才配置的凭证了
在这里插入图片描述
触发器默认选第一项即可
在这里插入图片描述
build栏目如下

build post的配置

在我们进行完成jar包的构建之后,需要将构建好的jar包文件打包成docker镜像,并上传到harbor仓库之中,选择第二个选项的意思是在完成jar的打包之后才进行下一步,然后输入需要执行的shell脚本自行自动化部署
在这里插入图片描述

# 进入jenkins打包完成的地址,下面有构建完成的jar包,你们打包完成后如果没有进行目录的修改,前缀应该和我的相同
cd /var/lib/jenkins/workspace/test-bjw/
# 进行docker镜像的构建,注意命名不可以用大写,否则会报错,还有就是这条命令最后有一个‘.’不要忽略,它表示在该目录下执行
docker build -t jenkins_bjw-1.0-snapshot .
# 连接远程harbor仓库
docker login -u admin -p Harbor12345 192.168.1.5:80
# 对docker镜像进行tag标签处理
docker tag jenkins_bjw-1.0-snapshot 192.168.1.5:80/jenkins/jenkins-bjw:v0
# 上传到harbor仓库之中
docker push 192.168.1.5:80/jenkins/jenkins-bjw:v0

构建不成功的可看下一节“可能遇到的问题”

4、 可能遇到的问题

(1)maven打包jar包失败

maven默认情况下,下载依赖的仓库地址非常慢,如果jenkins在进行jar包构建的时候依赖下载失败,请重新检查是否更换了mirror地址,具体操作在本文开始环节

(2)docker构建镜像的时候找不到Dockerfile文件

docker构建项目的时候需要安装Dockerfile的配置进行,但是有时候我们的目录下并没有该Dockerfile文件,所以需要进行Dockerfile文件的创建
1、从idea中打开对应项目,并复制Dockerfile下的内容
在这里插入图片描述
2、创建Dockerfile文件

vim Dockerfile

插入刚才复制的内容,如果你的项目中没有,可以按照我的文件进行修改

(3)docker中jenkins用户组不存在或者权限不足

我们知道jenkins在进行任务构建的时候需要进行dokcer命令的执行,若权限不足会导致失败

# 在docker中添加jenkins用户组
sudo usermod -aG docker jenkins
# 若还是失败,可以重启Jenkins和docker使该命令生效
(4)虚拟机中配置insecure-registries

不配置该条目将无法访问harbor容器

# 进入配置文件
vim /etc/docker/daemon.json
# 增添对应配置,对应上面的截图进行修改
"insecure-registries": ["harbor.domain.io"]
# 重启docker服务使之生效
service docker restart

效果如下,为harbor的虚拟机ip地址以及对应的服务端口号

在这里插入图片描述

(5)上传harbor容器的时候可能会因为命令输入错误而失败,对应的操作详见我的另一篇博客“虚拟机(CentOS7)虚拟机安装harbor及简单使用”

5、 成功部署

jenkins控制台输出如下
在这里插入图片描述
harbor容器中docker镜像如下
在这里插入图片描述

相关文章:

jenkins自动化构建docker镜像并上传至harbor仓库

1、插件下载 首先进入jenkins之后需要现在“Maven”、“GitLab”、“Jdk”、“SSH”、“Git”的相关插件&#xff0c;这里不再赘述&#xff0c;需要什么插件直接安装即可 搜索对应插件后选择直接安装即可 2、系统全局配置 2.1 Maven配置 配置maven安装的相应的setting文件 …...

Java高级Day23-HashMap

74.HashMap Map接口常用实现类&#xff1a;HashMap、Hashtable和Properties HashMap是Map接口使用频率最高的实现类 HashMap是以key-value对的方式来存储数据 key不能重复&#xff0c;但是值可以重复&#xff0c;允许使用null健和null值 如果添加相同的key&#xff0c;会覆…...

【学术会议征稿】第四届电气工程与计算机技术国际学术会议(ICEECT2024)

第四届电气工程与计算机技术国际学术会议&#xff08;ICEECT2024&#xff09; 2024 4th International Conference on Electrical Engineering and Computer Technology 第四届电气工程与计算机技术国际学术会议&#xff08;ICEECT2024&#xff09;将于9月27日-29日在哈尔滨举…...

Spring boot tomcat使用自定义线程池监控线程数量告警

Spring boot tocmat 使用自定义线程池 线程池 接近最大线程数量 警戒值告警 修改tomcat线程池中线程名字 配置文件上代码 server:port: 9898servlet:context-path: /testtomcat:connection-timeout: 5000max-connections: 5accept-count: 5 tomcat_thread_max_number_warn:…...

K8S子节点加入主节点访问MaterAPI报错:Unauthorized 401

问题场景&#xff1a; 本地测试由于之前安装过K8S今天重启无法使用了&#xff0c;于是重新安装了一下&#xff0c;子节点加入主节点报错&#xff1a; I0808 23:13:04.299356 19180 round_trippers.go:466] curl -v -XGET -H "Accept: application/json, */*" -H …...

C++ Poco服务端框架中JSON的使用

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、JSON是什么&#xff1f;二、使用步骤总结 前言 上面一篇文章教你学会了Poco开发服务端应用&#xff0c;这个教程教会你使用JSON。一般传JSON的时候都是POS…...

leetcode787. K 站中转内最便宜的航班——优先队列优化的Dijkstra算法+剪枝

题目 leetcode787. K 站中转内最便宜的航班 题目分析 给定一个城市图&#xff0c;每个城市通过航班与其他城市相连。每个航班都有一个起点、终点和价格。你需要找到从起点城市 src 到终点城市 dst 的最便宜路径&#xff0c;但这条路径最多只能经过 k 个中转站。你需要返回这…...

赛盈分销亮相AI科技大会暨亚马逊新增长大会,与企业共话跨境品牌发展新机遇!

八月开端&#xff0c;由知无不言与xmars和钱老师课堂联合主办的2024年AI科技大会暨亚马逊新增长大会在深圳宝安顺利开展&#xff0c;为期2天的跨境峰会吸引了上千位优秀的卖家朋友前来感受一场盛夏大狂欢。在本次跨境峰会里&#xff0c;邀请了多位不同领域的先锋人物&#xff0…...

Nacos-配置中心

1.为什么要使用配置中心&#xff1f; 2.常用的配置中心组件&#xff1f; 3.如何使用&#xff1f; 在配置中心创建配置文件 启动一个单列的nacos服务 点击发布 在微服务中使用 添加依赖 <!--nacso配置中心的依赖--><dependency><groupId>com.alibaba.cloud&l…...

ava中的文件操作、IO流、递归和字符集

目录 File类的使用 创建File对象 创建和删除文件 遍历文件夹 IO流 字节流 读取文件 字符流 读取文本文件 写入文本文件 递归 计算阶乘 文件搜索 字符集 编码与解码 File类的使用 在Java中&#xff0c;File类用于表示文件和目录的路径。它提供了一些方法来创建、删…...

生成式人工智能安全评估体系构建

文章目录 前言一、人工智能安全治理的现状1.1 国际安全治理现状1.2 国内安全治理现状二、构建人工智能安全评估体系1.1 需要对生成式人工智能技术的安全性、可靠性、可控性、公平性等维度进行全面的考量。1.2 应对生成式人工智能全维度风险。1.3 在体系化应对框架中,应明确法律…...

NRBO-XGBoost分类 基于牛顿-拉夫逊优化算法[24年最新算法]-XGBoost多特征分类预测+交叉验证

NRBO-XGBoost分类 基于牛顿-拉夫逊优化算法[24年最新算法]-XGBoost多特征分类预测交叉验证 多输入单输出&#xff09; matlab代码 程序已调试好&#xff0c;无需更改代码替换数据直接使用&#xff01;&#xff01;&#xff01;数据格式为excel格式&#xff01;需要定制可私&a…...

synchronized实现原理及优化

一、概述 线程安全在并发编程中是重要关注点&#xff0c;造成线程安全问题的主要诱因有两个&#xff1a;一是存在共享数据&#xff08;也称临界资源&#xff09;&#xff0c;二是存在多个线程共同操作共享数据。synchronized关键字能够保证在同一时刻只有一个线程可以执行某个…...

NLP 之词的表示与语言模型

表示的基本原理&#xff1a; 机器无法理解文字&#xff0c;却能进行复杂的数学运算——神经网络只要够深、够复杂&#xff0c;就能拟合足够复杂的数学模式。把文字嵌入&#xff08;embed&#xff09;到一个向量空间中去。 词表示&#xff08;Word Representation&#xff09;…...

每天一个数据分析题(四百七十一)- 假设检验

下列对假设检验的描述合理的是? A. 备择假设是研究者想收集证据予以支持的假设 B. 原假设是研究者想收集证据予以推翻的假设 C. 原假设是研究者想收集证据予以支持的假设 D. 备择假设是研究者想收集证据予以推翻的假设 数据分析认证考试介绍&#xff1a;点击进入 题目来…...

《系统架构设计师教程(第2版)》第13章-层次式架构设计理论与实践-04-数据访问层设计

文章目录 1. 五种数据访问模式1.1 在线访问1.2 DAO1.3 DTO1.4 离线数据模式1.5 对象/关系映射 (O/R Mapping) 2. 工厂方法模式在数据访问层应用3 ORM、Hibernate与CMP2.0设计思想3.1 ORM3.2 Hibernate1&#xff09;概述2&#xff09; Hibernate的架构&#xff08;2023年的考题&…...

【视觉SLAM】 十四讲ch7习题

简介 本文主要内容是《视觉SLAM十四讲》&#xff08;第二版&#xff09;第7章的习题解答&#xff0c;并介绍了在解答习题中的一下思考和总结的经验。本文代码部分参考了&#xff1a;HW-of-SLAMBOOK2 1、除了本书介绍的ORB特征点&#xff0c;你还能找到哪些特征点&#xff1f;…...

K-近邻算法(二)

三、 kd 树 问题导⼊&#xff1a; 实现k 近邻算法时&#xff0c; 主要考虑的问题是如何对训练数据进⾏快速 k 近邻搜索。这在特征空间的维数⼤及训练数据容量⼤时尤其必要。 k 近邻法最简单的实现是线性扫描&#xff08;穷举搜索&#xff09;&#xff0c;即要计算输⼊实例与…...

WPF学习(2)-UniformGrid控件(均分布局)+StackPanel控件(栈式布局)

UniformGrid控件&#xff08;均分布局&#xff09; UniformGrid和Grid有些相似&#xff0c;只不过UniformGrid的每个单元格面积都是相等的&#xff0c;不管是横向的单元格&#xff0c;或是纵向的单元格&#xff0c;它们会平分整个UniformGrid。 UniformGrid控件提供了3个属性…...

ANTSDR E310

ANTSDR E310是一款由微相科技有限公司&#xff08;MicroPhase&#xff09;推出的软件无线电&#xff08;SDR&#xff09;平台&#xff0c;专为现场部署设计。以下是对ANTSDR E310的详细介绍&#xff1a; 一、主要特点 独立运行的软件无线电&#xff1a;ANTSDR E310具备独立运…...

wordpress后台更新后 前端没变化的解决方法

使用siteground主机的wordpress网站&#xff0c;会出现更新了网站内容和修改了php模板文件、js文件、css文件、图片文件后&#xff0c;网站没有变化的情况。 不熟悉siteground主机的新手&#xff0c;遇到这个问题&#xff0c;就很抓狂&#xff0c;明明是哪都没操作错误&#x…...

ubuntu搭建nfs服务centos挂载访问

在Ubuntu上设置NFS服务器 在Ubuntu上&#xff0c;你可以使用apt包管理器来安装NFS服务器。打开终端并运行&#xff1a; sudo apt update sudo apt install nfs-kernel-server创建共享目录 创建一个目录用于共享&#xff0c;例如/shared&#xff1a; sudo mkdir /shared sud…...

【CSS position 属性】static、relative、fixed、absolute 、sticky详细介绍,多层嵌套定位示例

文章目录 ★ position 的五种类型及基本用法 ★ 一、position 属性概述 二、position 的五种类型详解(初学者版) 1. static(默认值) 2. relative(相对定位) 3. absolute(绝对定位) 4. fixed(固定定位) 5. sticky(粘性定位) 三、定位元素的层级关系(z-i…...

前端开发面试题总结-JavaScript篇(一)

文章目录 JavaScript高频问答一、作用域与闭包1.什么是闭包&#xff08;Closure&#xff09;&#xff1f;闭包有什么应用场景和潜在问题&#xff1f;2.解释 JavaScript 的作用域链&#xff08;Scope Chain&#xff09; 二、原型与继承3.原型链是什么&#xff1f;如何实现继承&a…...

什么?连接服务器也能可视化显示界面?:基于X11 Forwarding + CentOS + MobaXterm实战指南

文章目录 什么是X11?环境准备实战步骤1️⃣ 服务器端配置(CentOS)2️⃣ 客户端配置(MobaXterm)3️⃣ 验证X11 Forwarding4️⃣ 运行自定义GUI程序(Python示例)5️⃣ 成功效果![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/55aefaea8a9f477e86d065227851fe3d.pn…...

浅谈不同二分算法的查找情况

二分算法原理比较简单&#xff0c;但是实际的算法模板却有很多&#xff0c;这一切都源于二分查找问题中的复杂情况和二分算法的边界处理&#xff0c;以下是博主对一些二分算法查找的情况分析。 需要说明的是&#xff0c;以下二分算法都是基于有序序列为升序有序的情况&#xf…...

Web 架构之 CDN 加速原理与落地实践

文章目录 一、思维导图二、正文内容&#xff08;一&#xff09;CDN 基础概念1. 定义2. 组成部分 &#xff08;二&#xff09;CDN 加速原理1. 请求路由2. 内容缓存3. 内容更新 &#xff08;三&#xff09;CDN 落地实践1. 选择 CDN 服务商2. 配置 CDN3. 集成到 Web 架构 &#xf…...

华硕a豆14 Air香氛版,美学与科技的馨香融合

在快节奏的现代生活中&#xff0c;我们渴望一个能激发创想、愉悦感官的工作与生活伙伴&#xff0c;它不仅是冰冷的科技工具&#xff0c;更能触动我们内心深处的细腻情感。正是在这样的期许下&#xff0c;华硕a豆14 Air香氛版翩然而至&#xff0c;它以一种前所未有的方式&#x…...

保姆级教程:在无网络无显卡的Windows电脑的vscode本地部署deepseek

文章目录 1 前言2 部署流程2.1 准备工作2.2 Ollama2.2.1 使用有网络的电脑下载Ollama2.2.2 安装Ollama&#xff08;有网络的电脑&#xff09;2.2.3 安装Ollama&#xff08;无网络的电脑&#xff09;2.2.4 安装验证2.2.5 修改大模型安装位置2.2.6 下载Deepseek模型 2.3 将deepse…...

力扣热题100 k个一组反转链表题解

题目: 代码: func reverseKGroup(head *ListNode, k int) *ListNode {cur : headfor i : 0; i < k; i {if cur nil {return head}cur cur.Next}newHead : reverse(head, cur)head.Next reverseKGroup(cur, k)return newHead }func reverse(start, end *ListNode) *ListN…...