Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徐晓伟工作室
gitlab-k8s
提交
627f9bf2
G
gitlab-k8s
项目概览
徐晓伟工作室
/
gitlab-k8s
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-k8s
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
627f9bf2
编写于
5月 02, 2024
作者:
徐晓伟
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
👷
docker
上级
a04b4133
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
126 addition
and
21 deletion
+126
-21
.gitlab-ci.yml
.gitlab-ci.yml
+53
-21
Dockerfile
Dockerfile
+12
-0
docker-compose.yml
docker-compose.yml
+9
-0
docker/nginx.conf
docker/nginx.conf
+52
-0
未找到文件。
.gitlab-ci.yml
浏览文件 @
627f9bf2
stages
:
-
build
-
publish
# 代码同步
-
pages
-
docker:build
-
docker:deploy
-
sync
variables
:
DOCKER_TAG
:
0.0.1
pages
:
stage
:
build
stage
:
pages
image
:
node:18.17.1
cache
:
key
:
"
${CI_JOB_NAME}"
...
...
@@ -15,6 +18,9 @@ pages:
-
if [ $CI_SERVER_HOST == 'gitlab.helm.xuxiaowei.cn' ]; then
yarn config set registry https://registry.npmmirror.com;
fi
-
if [ $CI_SERVER_HOST == 'jihulab.com' ]; then
yarn config set registry https://registry.npmmirror.com;
fi
-
yarn
-
yarn build
-
mv build/ public/
...
...
@@ -23,10 +29,10 @@ pages:
paths
:
-
public/
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
-
if
:
$CI_COMMIT_BRANCH == "main"
&& $ENABLE_DOCS == "true"
build:npm:
stage
:
build
stage
:
pages
image
:
node:18.17.1
cache
:
key
:
"
${CI_JOB_NAME}"
...
...
@@ -36,6 +42,9 @@ build:npm:
-
if [ $CI_SERVER_HOST == 'gitlab.helm.xuxiaowei.cn' ]; then
npm config set registry https://registry.npmmirror.com;
fi
-
if [ $CI_SERVER_HOST == 'jihulab.com' ]; then
npm config set registry https://registry.npmmirror.com;
fi
-
npm install
-
npm run build
-
mv build/ public/
...
...
@@ -47,7 +56,7 @@ build:npm:
-
if
:
$CI_COMMIT_BRANCH == "main"
build:pnpm:
stage
:
build
stage
:
pages
image
:
node:18.17.1
cache
:
key
:
"
${CI_JOB_NAME}"
...
...
@@ -57,6 +66,9 @@ build:pnpm:
-
if [ $CI_SERVER_HOST == 'gitlab.helm.xuxiaowei.cn' ]; then
yarn config set registry https://registry.npmmirror.com;
fi
-
if [ $CI_SERVER_HOST == 'jihulab.com' ]; then
yarn config set registry https://registry.npmmirror.com;
fi
-
yarn global add pnpm
-
if [ $CI_SERVER_HOST == 'gitlab.helm.xuxiaowei.cn' ]; then
pnpm config set registry https://registry.npmmirror.com;
...
...
@@ -71,25 +83,45 @@ build:pnpm:
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
publish-gitee-pages
:
stage
:
publish
docker:build:
stage
:
docker:build
image
:
name
:
xuxiaoweicomcn/kaniko-project-executor:v1.22.0-debug
entrypoint
:
[
"
"
]
needs
:
-
job
:
pages
artifacts
:
true
image
:
bitnami/git:2.40.1
before_script
:
-
echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"https://index.docker.io/v1/\":{\"auth\":\"$(printf "%s:%s" ${DOCKER_USERNAME} "${DOCKER_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script
:
-
git config --global user.email $GITLAB_USER_EMAIL
-
git config --global user.name $GITLAB_USER_NAME
-
git config --global user.email
-
git config --global user.name
-
echo 当前分支:$CI_COMMIT_BRANCH
-
git checkout -b $CI_COMMIT_BRANCH
-
git add -f public/
-
git commit -m "发布 Gitee Pages
"
-
git remote add gitee https://xuxiaowei-com-cn:$GITEE_PRIVATE_TOKEN@gitee.com/$CI_PROJECT_PATH.git
-
git push -f -u gitee $CI_COMMIT_BRANCH:pages
-
echo $DOCKER_TAG
-
/kaniko/executor version
-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--build-arg "CI_PIPELINE_URL=${CI_PIPELINE_URL}"
--destination "${CI_REGISTRY_IMAGE}:${DOCKER_TAG}"
--destination "${CI_REGISTRY_IMAGE}:${DOCKER_TAG}-${CI_PIPELINE_ID}
"
--destination "xuxiaoweicomcn/gitlab-k8s:${DOCKER_TAG}"
--destination "xuxiaoweicomcn/gitlab-k8s:${DOCKER_TAG}-${CI_PIPELINE_ID}"
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
-
if
:
$CI_COMMIT_BRANCH == "main" && $ENABLE_DOCS_DOCKER == "true"
docker:deploy:
stage
:
docker:deploy
needs
:
-
job
:
docker:build
image
:
docker:26.1.1-cli
variables
:
DOCKER_HOST
:
$DEPLOY_DOCKER_HOST
script
:
-
docker info
-
docker compose up -d
environment
:
production
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main" && $ENABLE_DOCS_DOCKER_DEPLOY == "true"
tags
:
-
lighthouse-docker
# 嵌入
include
:
...
...
Dockerfile
0 → 100644
浏览文件 @
627f9bf2
FROM
nginx:1.26.0
LABEL
maintainer="徐晓伟 <xuxiaowei@xuxiaowei.com.cn>"
ARG
CI_PIPELINE_URL
ENV
CI_PIPELINE_URL=${CI_PIPELINE_URL}
ADD
public /usr/share/nginx/html/gitlab-k8s
ADD
docker/nginx.conf /etc/nginx/conf.d/default.conf
RUN
sed
-i
'/http {/a\ server_tokens off;'
/etc/nginx/nginx.conf
docker-compose.yml
0 → 100644
浏览文件 @
627f9bf2
services
:
gitlab-k8s
:
image
:
${CI_REGISTRY_IMAGE}:${DOCKER_TAG}-${CI_PIPELINE_ID}
restart
:
always
ports
:
-
${GITLAB_K8S_PORT:-45650}:80
volumes
:
-
/gitlab-k8s/logs:/var/log/nginx
container_name
:
gitlab-k8s
docker/nginx.conf
0 → 100644
浏览文件 @
627f9bf2
server
{
listen
80
;
listen
[::]:80
;
server_name
localhost
;
server_tokens
off
;
access_log
/var/log/nginx/gitlab-k8s.access.log
main
;
error_log
/var/log/nginx/gitlab-k8s.error.log
notice
;
location
/
{
root
/usr/share/nginx/html/gitlab-k8s
;
index
index.html
index.htm
;
}
location
/gitlab-k8s
{
root
/usr/share/nginx/html
;
index
index.html
index.htm
;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page
500
502
503
504
/50x.html
;
location
=
/50x.html
{
root
/usr/share/nginx/html
;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录