<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
    <title>PrendsMoi&#39;s Blog - docker</title>
    <link rel="self" type="application/atom+xml" href="https://liuhgxu.com/tags/docker/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://liuhgxu.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-08-30T00:00:00+00:00</updated>
    <id>https://liuhgxu.com/tags/docker/atom.xml</id>
    <entry xml:lang="zh">
        <title>docker搭建</title>
        <published>2026-08-30T00:00:00+00:00</published>
        <updated>2026-08-30T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://liuhgxu.com/blog/docker-setup/"/>
        <id>https://liuhgxu.com/blog/docker-setup/</id>
        
        <content type="html" xml:base="https://liuhgxu.com/blog/docker-setup/">&lt;h1 id=&quot;gitlab-ci-cd-da-jian&quot;&gt;GitLab-CI/CD 搭建&lt;/h1&gt;
&lt;h2 id=&quot;dockerda-jian&quot;&gt;docker搭建&lt;/h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 更新apt包索引&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; apt-get update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 卸载旧版的docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; apt-get remove docker docker-engine docker.io containerd runc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 一键安装docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; -sSL https://get.daocloud.io/docker&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt; sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;gitlabda-jian&quot;&gt;gitlab搭建&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;安装gitlab&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# docker安装gitlab镜像&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; pull gitlab/gitlab-ce:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 运行gitlab的docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; run&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    --publish 8443:443 --publish 8080:80 --publish 2222:22&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    --name gitlab&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    --volume /home/gitlab/config:/etc/gitlab&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    --volume /home/gitlab/logs:/var/log/gitlab&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    --volume /home/gitlab/data:/var/opt/gitlab&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;    gitlab/gitlab-ce&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 暂时关闭服务器防火墙&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt; systemctl&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; stop firewalld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 浏览器输入 http://ip:port 访问gitlab&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;优化gitlab的内存占用&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 进入到gitlab的bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; exec -it&lt;/span&gt;&lt;span&gt; ${gitlab的docker id}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; /bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 编辑gitlab的配置文件&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;vi&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; /etc/gitlab/gitlab.rb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容start ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;puma[&amp;#39;worker_processes&amp;#39;]&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt; 4&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 去掉#注释 设置进程 不能低于2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;puma[&amp;#39;worker_timeout&amp;#39;]&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt; 60&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 设置超时时间&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容end ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 重启gitlab&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;gitlab-ctl&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;配置gitlab clone克隆地址&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 进入到gitlab的bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; exec -it&lt;/span&gt;&lt;span&gt; ${gitlab的docker id}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; /bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 编辑配置文件&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;vi&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; /etc/gitlab/gitlab.rb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容start ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;external_url&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;#39;http://ip:port&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # 访问地址 port为docker run时设置的8080&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;gitlab_rails[&amp;#39;gitlab_shell_ssh_port&amp;#39;]&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt; 2222&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # ssh端口号 为docker run时设置的2222&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;gitlab_rails[&amp;#39;gitlab_ssh_host&amp;#39;]&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; = ip&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # ssh的访问ip&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容end ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 修改配置文件&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;vi&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容start ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ip地址&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # 设置ip地址&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;port&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; 访问端口&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 设置访问端口 同external_url设置的端口号&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;###### 修改配置内容end ######&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 重启gitlab&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;gitlab-ctl&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;an-zhuang-pei-zhi-git-runner&quot;&gt;安装配置git-runner&lt;/h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 安装git-runner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; docker run -d --name gitlab-runner --restart always&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  -v /home/gitlab-runner/config:/etc/gitlab-runner&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  -v /var/run/docker.sock:/var/run/docker.sock&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  gitlab/gitlab-runner:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 注册&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --non-interactive&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --executor &amp;quot;docker&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --docker-image alpine:latest&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --url &amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --registration-token &amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --description &amp;quot;first-register-runner&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --tag-list &amp;quot;vue3-app&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --run-untagged=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --locked=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;  --access-level=&amp;quot;not_protected&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;font color=red size=4&gt;注册需要token和url，获取方式如下图&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210819101503795.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210819101503795.png&quot; alt=&quot;image-20210819101503795&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CI/CD配置yaml脚本需要的变量&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210823163059650.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210823163059650.png&quot; alt=&quot;image-20210823163059650&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;bian-xie-gitlab-ci-yml-checkered-flag&quot;&gt;编写.gitlab-ci.yml 🏁&lt;/h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;stages&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; init&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 初始化&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; lint&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 校验&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; build&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 打包&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; deploy&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 部署&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 在流水线中使用package.json缓存node_modules,只要package.json内容没变就一直使用缓存&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;cache&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  key&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    files&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; package.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  paths&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; node_modules/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# npm i 安装&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;init&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  stage&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; init&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  only&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    refs&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; merge_requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    variables&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &amp;quot;develop&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; npm cache clean --force&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; npm install -g cnpm --registry=https://registry.npm.taobao.org&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; cnpm install&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  after_script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod a+x ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 给钉钉的脚本添加权限&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # 执行钉钉脚本&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 代码校验&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;lint&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  stage&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; lint&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  only&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    refs&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; merge_requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    variables&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &amp;quot;develop&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; npm run lint:jsx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; npm run lint:css&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  allow_failure&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #FAB387;&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 开始构建&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;build&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  stage&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; build&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  artifacts&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;    # 文件名&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;#39;dist&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;    # 过期时间&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    expire_in&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; 60 mins&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;    # 需要打包目录&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    paths&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; dist/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  only&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    refs&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; merge_requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    variables&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &amp;quot;develop&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 表示只有往 develop分支提MR才会触发部署&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; npm run build:test&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  after_script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod a+x ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 给钉钉的脚本添加权限&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # 执行钉钉脚本&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;deploy&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  stage&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; deploy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  only&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    refs&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; merge_requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;    variables&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == &amp;quot;develop&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 表示只有往 develop分支提MR才会触发部署&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;#39;which ssh-agent || ( apk update &amp;amp;&amp;amp; apk add openssh-client)&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 预先装 ssh-agent&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; eval $(ssh-agent -s)&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 启动服务&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; mkdir -p  /etc/ssh/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod 700  /etc/ssh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; echo &amp;quot;$SSH_KNOWHOST&amp;quot; &amp;gt; /etc/ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; echo &amp;quot;$SSH_PRIVATE_KEY&amp;quot; &amp;gt; /etc/ssh/id_rsa&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; echo &amp;quot;$SSH_CONFIG&amp;quot; &amp;gt; /etc/ssh/ssh_config.d/config.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;    # 配置较低权限&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod 600 /etc/ssh/id_rsa&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod 600 //etc/ssh/ssh_config.d/config.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod 644 /etc/ssh/known_hosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;    # 注入密钥&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ssh-add /etc/ssh/id_rsa&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ssh Aliyun &amp;quot;rm -rf /var/www/project/test&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; scp -i /etc/ssh/id_rsa -r ./dist/ &amp;quot;$SSH_USERNAME&amp;quot;@&amp;quot;$SSH_HOST&amp;quot;:/var/www/project/test/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  after_script&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; chmod a+x ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 给钉钉的脚本添加权限&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; ./dingding.sh&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # 执行钉钉脚本&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;&quot;&gt;  when&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; on_success&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;ding-ding-pei-zhi&quot;&gt;钉钉配置&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;群助手设置&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;创建群&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加智能群助手&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210823162617640.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210823162617640.png&quot; alt=&quot;image-20210823162617640&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加自定义机器人&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210823162728847.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210823162728847.png&quot; alt=&quot;image-20210823162728847&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210823162904447.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210823162904447.png&quot; alt=&quot;image-20210823162904447&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;配置机器人&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://img.liuhgxu.com/img/image-20210823162933552.png&quot;&gt;&lt;img src=&quot;https://img.liuhgxu.com/img/image-20210823162933552.png&quot; alt=&quot;image-20210823162933552&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;shell脚本&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #CDD6F4; background-color: #1E1E2E;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #F5C2E7;font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;##################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 钉钉通知&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 自动化部署脚本中使用&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;##################&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;webhook&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;https://oapi.dingtalk.com/robot/send?access_token=&lt;/span&gt;&lt;span&gt;${DINGDING_TOKEN}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt; # 你自己创建的钉钉机器人的地址&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;# 推送模板发送（模板拼接）&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt; sendDingTalkNotifications&lt;/span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;      local&lt;/span&gt;&lt;span&gt; text&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;#### git名称：&lt;/span&gt;&lt;span&gt;${CI_PROJECT_NAME}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; \n ##### 构建分支：&lt;/span&gt;&lt;span&gt;${CI_COMMIT_REF_NAME}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; \n ##### 构建状态：&lt;/span&gt;&lt;span&gt;${DEPLOY_STATUS}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;\n #### 提交者：&lt;/span&gt;&lt;span&gt;${GITLAB_USER_NAME}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;-&lt;/span&gt;&lt;span&gt;${GITLAB_USER_EMAIL}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; \n\n\n ##### 更新内容：&lt;/span&gt;&lt;span&gt;${CI_COMMIT_MESSAGE}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; \n ##### [流水线 Pipeline #&lt;/span&gt;&lt;span&gt;${CI_PIPELINE_ID}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;](&lt;/span&gt;&lt;span&gt;${CI_PROJECT_URL}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;/pipelines/&lt;/span&gt;&lt;span&gt;${CI_PIPELINE_ID}&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;) \n&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;      curl&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; POST &amp;quot;&lt;/span&gt;&lt;span&gt;$webhook&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot; -H &amp;#39;Content-Type: application/json&amp;#39; -d &amp;quot;{&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;msgtype&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;markdown&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;markdown&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;: {&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span&gt;${CI_PROJECT_NAME}&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;text&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span&gt;$text&lt;/span&gt;&lt;span style=&quot;color: #F5C2E7;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;}}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$?&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt; -eq&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt; &amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt; ];&lt;/span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;color: #9399B2;font-style: italic;&quot;&gt;  # &amp;quot;$?&amp;quot; -eq &amp;quot;0&amp;quot; 表示上一句脚本执行成功，1的话表示失败&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;      case&lt;/span&gt;&lt;span&gt; ${CI_JOB_STAGE}&lt;/span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt; in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;            &amp;quot;init&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  DEPLOY_STATUS&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;初始化安装成功!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;                  sendDingTalkNotifications&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;            ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;            &amp;quot;build&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  DEPLOY_STATUS&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;构建成功!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;                  sendDingTalkNotifications&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;            ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;            &amp;quot;deploy&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;)&lt;/span&gt;&lt;span&gt; DEPLOY_STATUS&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;部署成功!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;                  sendDingTalkNotifications&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;            ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;      esac&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;      case&lt;/span&gt;&lt;span&gt; ${CI_JOB_STAGE}&lt;/span&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt; in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;            &amp;quot;init&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  DEPLOY_STATUS&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;构建失败!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;                  sendDingTalkNotifications&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;            ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;            &amp;quot;deploy&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  DEPLOY_STATUS&lt;/span&gt;&lt;span style=&quot;color: #94E2D5;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A6E3A1;&quot;&gt;&amp;#39;部署失败!&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #89B4FA;font-style: italic;&quot;&gt;                  sendDingTalkNotifications&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #9399B2;&quot;&gt;            ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;      esac&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #CBA6F7;&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;warning-zhu-yi-dian&quot;&gt;⚠️注意点&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;git-runner执行时候权限问题
&lt;ul&gt;
&lt;li&gt;进入gitlab-runner的docker，修改/etc/passwd文件中的gitlab-runner的权限与root同等级0&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;can-kao-wen-zhang&quot;&gt;参考文章&lt;/h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.runoob.com/docker/docker-tutorial.html&quot;&gt;Docker 教程 | 菜鸟教程 (runoob.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://segmentfault.com/a/1190000014305359&quot;&gt;使用docker搭建gitlab环境 - SegmentFault 思否&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://juejin.cn/post/6967972435064782879&quot;&gt;GitLab+Docker快速搭建CI/CD自动化部署 (juejin.cn)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://juejin.cn/post/6995926592887193631&quot;&gt;利用 Gitlab CI/CD + Jenkins 实现自动构建，自动部署 (juejin.cn)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://ssoor.github.io/2020/03/25/gitlab-ci-config-file/&quot;&gt;Gitlab-CI 配置文件 .gitlab-ci.yml 详细说明，基于官方文档翻译 | 渡渡岛 (ssoor.github.io)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://www.runoob.com/w3cnote/set-ssh-login-key.html&quot;&gt;设置 SSH 通过密钥登录 | 菜鸟教程 (runoob.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://soulteary.com/2021/07/14/gitlab-14-lightweight-operation-solution.html&quot;&gt;GitLab 14 轻量化运行方案 - 苏洋博客 (soulteary.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://xuezenghui.com/posts/gitlab-ci-cd/&quot;&gt;前端工程化之 CI/CD | Zander Hsueh (xuezenghui.com)&lt;/a&gt;&lt;/p&gt;
</content>
        
    </entry>
</feed>
