Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b12d24204 | |||
| 9f1cc5f6c7 | |||
| 358262f8ec | |||
| 717fea2f3c | |||
| 5ab941c89e | |||
| 02d8b44db1 | |||
| 8cfc4c178b | |||
| c7c30440c0 | |||
| 3511bd3186 | |||
| ef30ab4d1a | |||
| 7a638a7093 | |||
| c73f68659a |
Submodule
+1
Submodule .ci/common added at b0ca0dc3a3
@@ -1,5 +1,6 @@
|
|||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.gitmodules
|
||||||
|
|
||||||
./Makefile
|
./Makefile
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
# CI/CD 的阶段定义,按顺序执行各阶段;默认包含`.pre`(最先执行)/`.post`(最后执行)两个阶段,不用显示定义
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
# 全局变量定义
|
|
||||||
variables:
|
|
||||||
IMG_URL: "$HARBOR_HOST/$HARBOR_PROJECT/$CI_PROJECT_NAME"
|
|
||||||
IMG_TAG: ":latest"
|
|
||||||
|
|
||||||
# 默认值信息配置
|
|
||||||
default:
|
|
||||||
# 各 stage 使用的默认镜像,如果不定义,则为 gitlab-runner 创建时指定的镜像;各 stage 可以覆盖该值以使用不同的镜像
|
|
||||||
image: docker.colovu.com/library/docker:20.10.16
|
|
||||||
# Gitlab-runner 配置的执行器为 Docker 时,需要 配置对应的 dind 服务(这里使用Runner中配置的Dind服务)
|
|
||||||
#services:
|
|
||||||
# - name: docker.colovu.com/library/docker:20.10.16-dind
|
|
||||||
# alias: docker
|
|
||||||
# 流水线中,各阶段都会执行的脚本命令,包括`before_script`(在各阶段 script 前执行)/`after_script`(在各阶段 script 后执行)
|
|
||||||
before_script:
|
|
||||||
- |
|
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
|
||||||
IMG_TAG=":latest"
|
|
||||||
else
|
|
||||||
IMG_TAG=":$CI_COMMIT_REF_NAME"
|
|
||||||
fi
|
|
||||||
- docker login -u "$HARBOR_USERNAME" -p "$HARBOR_PASSWORD" $HARBOR_URL
|
|
||||||
|
|
||||||
# 环境变量信息
|
|
||||||
env-variables:
|
|
||||||
stage: .pre
|
|
||||||
script:
|
|
||||||
- export
|
|
||||||
|
|
||||||
# 编译阶段任务
|
|
||||||
build-arm64:
|
|
||||||
stage: build
|
|
||||||
tags:
|
|
||||||
- arm64
|
|
||||||
script:
|
|
||||||
- docker buildx build --platform=linux/arm64 --pull -t "$IMG_URL$IMG_TAG-linux-arm64" . --push
|
|
||||||
- docker rmi "$IMG_URL$IMG_TAG-linux-arm64"
|
|
||||||
|
|
||||||
build-amd64:
|
|
||||||
stage: build
|
|
||||||
tags:
|
|
||||||
- amd64
|
|
||||||
script:
|
|
||||||
- docker buildx build --platform=linux/amd64 --pull -t "$IMG_URL$IMG_TAG-linux-amd64" . --push
|
|
||||||
- docker rmi "$IMG_URL$IMG_TAG-linux-amd64"
|
|
||||||
|
|
||||||
build-artifact:
|
|
||||||
stage: build
|
|
||||||
needs: [build-amd64, build-arm64]
|
|
||||||
script:
|
|
||||||
- docker manifest create "$IMG_URL$IMG_TAG" "$IMG_URL$IMG_TAG-linux-arm64" "$IMG_URL$IMG_TAG-linux-amd64"
|
|
||||||
- docker manifest push "$IMG_URL$IMG_TAG"
|
|
||||||
- docker manifest rm "$IMG_URL$IMG_TAG"
|
|
||||||
|
|
||||||
# 测试阶段任务
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- docker run --pull always --rm --platform=linux/arm64 "$IMG_URL$IMG_TAG" /bin/uname -a
|
|
||||||
- docker run --pull always --rm --platform=linux/amd64 "$IMG_URL$IMG_TAG" /bin/uname -a
|
|
||||||
- docker images -q "$IMG_URL" | sort -u | xargs docker rmi -f
|
|
||||||
|
|
||||||
# 部署阶段任务
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- echo "deploy stage"
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule ".ci/common"]
|
||||||
|
path = .ci/common
|
||||||
|
url = https://git.colovu.com/docker/common.git
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# 注意:
|
||||||
|
# 1. git commit 信息中包含"[CI SKIP]"或"[SKIP CI]"则不触发工作流(注意大小写)
|
||||||
|
# 2. 工作步骤中包含 volumes 挂载时,需在 Woodpecker 配置中添加 volumes 挂载信任(Trust)
|
||||||
|
# 3. lables 配置项,可配置多个;如果存在,则必须完全符合 Runner 创建时设置的 Lables 配置项
|
||||||
|
# 4. command 中,引用自定义变量不能使用`${VAR}`方式,需要使用`$VAR`方式;带花括号的变量,会在 Woodpecker 模板引擎解析阶段被替换(此时变量为空)
|
||||||
|
# 5. 多架构编译后推送至 SWR 报错,或单架构编译后必须在推送时明确指定架构信息才能推送;可通过在编译命令中增加参数`--provenance=false --sbom=false`解决
|
||||||
|
# 6. 使用 Git Submodule 管理通用脚本时,需手动更新 Submodule
|
||||||
|
|
||||||
|
when:
|
||||||
|
# 匹配 main
|
||||||
|
- event: push
|
||||||
|
branch: main
|
||||||
|
# 匹配 master
|
||||||
|
- event: push
|
||||||
|
branch: master
|
||||||
|
# 匹配数字开头的分支,如 1.0, 2, 3.2.1
|
||||||
|
- event: push
|
||||||
|
branch: "[0-9]*"
|
||||||
|
# 匹配 v 开头的版本分支,如 v1, v2.0
|
||||||
|
- event: push
|
||||||
|
branch: "v[0-9]*"
|
||||||
|
# 匹配 tag 事件
|
||||||
|
- event: tag
|
||||||
|
ref: "refs/tags/(v?[0-9].*)"
|
||||||
|
|
||||||
|
labels:
|
||||||
|
runtime: docker
|
||||||
|
arch: amd64
|
||||||
|
multiarch: "true"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 初始化子模块
|
||||||
|
image: alpine/git
|
||||||
|
commands:
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
|
||||||
|
- name: 编译并推送镜像
|
||||||
|
image: docker:cli
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
SWR_REGISTRY: "swr.cn-north-4.myhuaweicloud.com"
|
||||||
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||||
|
SWR_USERNAME:
|
||||||
|
from_secret: swr_colovu_user
|
||||||
|
SWR_PASSWORD:
|
||||||
|
from_secret: swr_colovu_passwd
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
# 直接执行 Submodule .ci/common 下的构建推送脚本
|
||||||
|
if [ ! -f ".ci/common/build_push.sh" ]; then
|
||||||
|
echo "错误: 未找到 .ci/common/build_push.sh 脚本"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- sh ./.ci/common/build_push.sh
|
||||||
+21
-12
@@ -16,24 +16,35 @@
|
|||||||
# 该部分变量,在编译命令中通过 `--build-arg` 传入;如果未设置,则使用下面对应的默认值
|
# 该部分变量,在编译命令中通过 `--build-arg` 传入;如果未设置,则使用下面对应的默认值
|
||||||
|
|
||||||
ARG APP_NAME=dBuilder
|
ARG APP_NAME=dBuilder
|
||||||
ARG APP_VER=12
|
ARG APP_VER=13
|
||||||
ARG REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/colovu/"
|
ARG REGISTRY_URL="docker.io/"
|
||||||
ARG APT_SOURCE=aliyun
|
ARG APT_SOURCE=aliyun
|
||||||
ARG LOCAL_URL="http://pkgs.colovu.com/dist"
|
|
||||||
|
|
||||||
# 1. 生成镜像 =====================================================================
|
# 1. 生成镜像 =====================================================================
|
||||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} ${REGISTRY_URL}debian:${APP_VER}
|
FROM ${REGISTRY_URL}debian:${APP_VER}
|
||||||
|
|
||||||
# 声明需要使用的全局可变参数(ARG声明的变量仅编译打包阶段有效)
|
# 声明需要使用的全局可变参数(ARG声明的变量仅编译打包阶段有效)
|
||||||
ARG APP_NAME
|
ARG APP_NAME
|
||||||
ARG APP_VER
|
ARG APP_VER
|
||||||
ARG APT_SOURCE
|
ARG APT_SOURCE
|
||||||
|
|
||||||
LABEL \
|
# 镜像元数据标签 - 符合OCI镜像规范
|
||||||
"Version"="v${APP_VER}" \
|
LABEL org.opencontainers.image.title="${APP_NAME}" \
|
||||||
"Description"="Docker image for Builder based on Debian." \
|
org.opencontainers.image.version="${APP_VER}" \
|
||||||
"Github"="https://gitee.com/colovu/docker-${APP_NAME}" \
|
org.opencontainers.image.description="Docker image for Debian Builder." \
|
||||||
"Vendor"="Endial Fang (endial@126.com)"
|
org.opencontainers.image.authors="Endial Fang <endial@126.com>" \
|
||||||
|
org.opencontainers.image.url="https://gitee.com/colovu/docker-${APP_NAME}" \
|
||||||
|
org.opencontainers.image.vendor="Endial Fang (colovu)" \
|
||||||
|
org.opencontainers.image.licenses="Apache-2.0" \
|
||||||
|
org.opencontainers.image.source="https://gitee.com/colovu/docker-${APP_NAME}" \
|
||||||
|
org.opencontainers.image.documentation="https://gitee.com/colovu/docker-${APP_NAME}/blob/main/README.md" \
|
||||||
|
maintainer="Endial Fang <endial@126.com>"
|
||||||
|
|
||||||
|
# 拷贝源仓库配置文件
|
||||||
|
COPY customer /
|
||||||
|
|
||||||
|
# 拷贝默认的通用脚本文件
|
||||||
|
COPY .ci/common/debian /
|
||||||
|
|
||||||
# 以下命令安装的软件包
|
# 以下命令安装的软件包
|
||||||
# apt-transport-https apt-utils binutils binutils-common
|
# apt-transport-https apt-utils binutils binutils-common
|
||||||
@@ -57,11 +68,9 @@ LABEL \
|
|||||||
# python3-minimal python3.7 python3.7-minimal readline-common sudo wget
|
# python3-minimal python3.7 python3.7-minimal readline-common sudo wget
|
||||||
# xz-utils
|
# xz-utils
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
# 选择软件包源,以加速后续软件包安装
|
|
||||||
select_source ${APT_SOURCE}; \
|
select_source ${APT_SOURCE}; \
|
||||||
\
|
\
|
||||||
# 安装编译环境及常用开发库
|
install_pkg sudo wget curl git ca-certificates iproute2 net-tools nano dpkg gnupg \
|
||||||
install_pkg sudo wget git ca-certificates iproute2 net-tools nano dpkg gnupg \
|
|
||||||
dirmngr apt-utils apt-transport-https lsb-release iputils-ping \
|
dirmngr apt-utils apt-transport-https lsb-release iputils-ping \
|
||||||
build-essential cmake libcmocka-dev pkg-config \
|
build-essential cmake libcmocka-dev pkg-config \
|
||||||
libssl3 libssl-dev \
|
libssl3 libssl-dev \
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
# Ver: 1.11 by Endial Fang (endial@126.com)
|
|
||||||
#
|
|
||||||
# 当前 Docker 镜像的编译脚本
|
|
||||||
|
|
||||||
# 定义镜像名称
|
|
||||||
image_name :=colovu/dbuilder
|
|
||||||
|
|
||||||
# 定义默认镜像仓库地址
|
|
||||||
REGISTRY_URL :=docker.colovu.com
|
|
||||||
|
|
||||||
# 定义系统默认使用的源服务器,包含:default / ustc / aliyun
|
|
||||||
APT_SOURCE :=aliyun
|
|
||||||
|
|
||||||
# 定义镜像TAG,类似:
|
|
||||||
# <镜像名>:<分支名>-<7位Git ID> # Git 仓库且无文件修改直接编译
|
|
||||||
# <镜像名>:<分支名>-<年月日>-<时分秒> # Git 仓库有文件修改后的编译
|
|
||||||
# <镜像名>:latest-<年月日>-<时分秒> # 非 Git 仓库编译
|
|
||||||
current_subversion:=$(shell if [ ! `git status >/dev/null 2>&1` ]; then git rev-parse --short HEAD; else date +%y%m%d-%H%M%S; fi)
|
|
||||||
image_tag:=$(shell if [ ! `git status >/dev/null 2>&1` ]; then git rev-parse --abbrev-ref HEAD | sed -e 's/master/latest/' | sed -e 's/main/latest/'; else echo "latest"; fi)-$(current_subversion)
|
|
||||||
|
|
||||||
build-arg:=--build-arg REGISTRY_URL=$(REGISTRY_URL)
|
|
||||||
build-arg+=--build-arg APT_SOURCE=$(APT_SOURCE)
|
|
||||||
|
|
||||||
# 设置本地下载服务器路径,加速调试时的本地编译速度
|
|
||||||
local_ip:=`echo "en0 eth0" | xargs -n1 ip addr show 2>/dev/null | grep inet | grep -v 127.0.0.1 | grep -v inet6 | tr "/" " " | awk '{print $$2}'`
|
|
||||||
build-arg+=--build-arg LOCAL_URL=http://local.colovu.com/dist
|
|
||||||
|
|
||||||
.PHONY: build clean clearclean upgrade
|
|
||||||
|
|
||||||
build:
|
|
||||||
@echo "Build $(image_name):$(image_tag)"
|
|
||||||
@docker buildx build --progress plain --force-rm $(build-arg) -t $(image_name):$(image_tag) .
|
|
||||||
@echo "Add tag: $(image_name):latest"
|
|
||||||
@docker tag $(image_name):$(image_tag) $(image_name):latest
|
|
||||||
@echo "Build complete"
|
|
||||||
|
|
||||||
# 清理悬空的镜像(无TAG)及停止的容器
|
|
||||||
clearclean: clean
|
|
||||||
@echo "Clean untaged images and stoped containers..."
|
|
||||||
@docker ps -a | grep "Exited" | awk '{print $$1}' | sort -u | xargs -L 1 docker rm
|
|
||||||
@docker images | grep '<none>' | awk '{print $$3}' | sort -u | xargs -L 1 docker rmi -f
|
|
||||||
|
|
||||||
# 为了防止删除前缀名相同的镜像,在过滤条件中加入一个空格进行过滤
|
|
||||||
clean:
|
|
||||||
@echo "Clean all images for current application..."
|
|
||||||
@docker images | grep "$(image_name) " | awk '{print $$3}' | sort -u | xargs -L 1 docker rmi -f
|
|
||||||
|
|
||||||
# 更新所有 colovu 仓库的镜像
|
|
||||||
upgrade:
|
|
||||||
@echo "Upgrade all images..."
|
|
||||||
@docker images | grep 'colovu' | grep -v '<none>' | grep -v "latest-" | awk '{print $$1":"$$2}' | sort -u | xargs -L 1 docker pull
|
|
||||||
|
|
||||||
@@ -7,15 +7,14 @@
|
|||||||
|
|
||||||
**版本信息:**
|
**版本信息:**
|
||||||
|
|
||||||
- 12、latest
|
- 13(trixie)、latest
|
||||||
|
- 12(bookworm)
|
||||||
|
|
||||||
**镜像信息:**
|
**镜像信息:**
|
||||||
|
|
||||||
* 镜像地址:
|
* 镜像地址:
|
||||||
* 华为云: swr.cn-north-4.myhuaweicloud.com/colovu/dBuilder:latest
|
* 华为云: swr.cn-north-4.myhuaweicloud.com/colovu/dbuilder
|
||||||
* Colovu: registry.colovu.com/library/dBuilder:latest
|
* 依赖镜像:swr.cn-north-4.myhuaweicloud.com/colovu/debian:12
|
||||||
* 依赖镜像:registry.colovu.com/library/debian:12
|
|
||||||
swr.cn-north-4.myhuaweicloud.com/colovu/debian:12
|
|
||||||
|
|
||||||
> 后续相关命令行默认使用华为云 SWR 镜像服务器做说明。
|
> 后续相关命令行默认使用华为云 SWR 镜像服务器做说明。
|
||||||
|
|
||||||
@@ -28,6 +27,9 @@ Docker 快速启动命令:
|
|||||||
docker run -it swr.cn-north-4.myhuaweicloud.com/colovu/dbuilder:latest /bin/bash
|
docker run -it swr.cn-north-4.myhuaweicloud.com/colovu/dbuilder:latest /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- latest:为镜像的 TAG,可针对性选择不同的 TAG 进行下载
|
||||||
|
- 不指定 TAG 时,默认下载`latest`镜像
|
||||||
|
|
||||||
## 数据卷
|
## 数据卷
|
||||||
|
|
||||||
镜像默认提供以下数据卷定义:
|
镜像默认提供以下数据卷定义:
|
||||||
@@ -91,6 +93,11 @@ CMD []
|
|||||||
- 不用安装、删除临时软件,放置生成多余的垃圾文件;预编译阶段的内容使用完即丢弃,不会对镜像大小产生影响
|
- 不用安装、删除临时软件,放置生成多余的垃圾文件;预编译阶段的内容使用完即丢弃,不会对镜像大小产生影响
|
||||||
- 没有相关的中间操作步骤,不会产生多余的镜像分层
|
- 没有相关的中间操作步骤,不会产生多余的镜像分层
|
||||||
|
|
||||||
|
## 更新记录
|
||||||
|
|
||||||
|
- 20260115: 增加 v13 版本
|
||||||
|
- 12、bookworm
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
本文原始来源 [Endial Fang](https://gitee.com/colovu) @ [Gitee.com](https://gitee.com)
|
本文原始来源 [Endial Fang](https://gitee.com/colovu) @ [Gitee.com](https://gitee.com)
|
||||||
|
|||||||
@@ -1,110 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Ver: 1.0 by Endial Fang (endial@126.com)
|
# Ver: 3.0 by Endial Fang (endial@126.com)
|
||||||
#
|
#
|
||||||
# Docker 镜像构建脚本 (仅linux/amd64)
|
# Docker 镜像构建脚本 - 主入口
|
||||||
|
|
||||||
IMAGE_NAME="dbuilder"
|
# 编译后镜像名称
|
||||||
REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/colovu/"
|
export IMAGE_NAME="debian-builder"
|
||||||
APT_SOURCE="aliyun"
|
# 依赖镜像的仓库地址(本镜像需要依赖原生 debian 镜像)
|
||||||
|
export REGISTRY_URL="swr.cn-north-4.myhuaweicloud.com/img-sync/docker.io/"
|
||||||
|
# 源仓库地址(本地编译时,使用阿里云源仓库)
|
||||||
|
export APT_SOURCE="aliyun"
|
||||||
|
# 针对无法直接下载到软件包,本地变异时,使用缓存的软件包
|
||||||
|
export LOCAL_URL="http://pkgs.colovu.com/dist"
|
||||||
|
|
||||||
# 获取发布版本标签
|
# 引入本地构建脚本
|
||||||
get_release_tag() {
|
if [ -f ".ci/common/build_local.sh" ]; then
|
||||||
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
# 执行本地构建脚本并传递参数
|
||||||
echo "unknown"
|
exec ".ci/common/build_local.sh" "$@"
|
||||||
elif [ -n "$(git status --porcelain)" ]; then
|
else
|
||||||
echo "latest"
|
echo "Error: .ci/common/build_local.sh script not found!"
|
||||||
else
|
exit 1
|
||||||
# 尝试获取最近的git标签
|
fi
|
||||||
local tag=$(git describe --tags --abbrev=0 2>/dev/null)
|
|
||||||
if [ -n "$tag" ]; then
|
|
||||||
echo "$tag"
|
|
||||||
else
|
|
||||||
local branch=$(git rev-parse --abbrev-ref HEAD)
|
|
||||||
case "$branch" in
|
|
||||||
master|main) echo "latest" ;;
|
|
||||||
*) echo "$branch" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 获取镜像完整TAG
|
|
||||||
get_image_tag() {
|
|
||||||
local CURRENT_SUBVERSION
|
|
||||||
if git rev-parse --git-dir >/dev/null 2>&1; then
|
|
||||||
if [ -z "$(git status --porcelain)" ]; then
|
|
||||||
CURRENT_SUBVERSION=$(git rev-parse --short=12 HEAD)
|
|
||||||
else
|
|
||||||
CURRENT_SUBVERSION=$(date +%Y%m%d-%H%M%S)
|
|
||||||
fi
|
|
||||||
local branch=$(git rev-parse --abbrev-ref HEAD)
|
|
||||||
branch=$(echo "$branch" | sed -e 's/master/latest/' -e 's/main/latest/')
|
|
||||||
echo "${branch}-${CURRENT_SUBVERSION}"
|
|
||||||
else
|
|
||||||
CURRENT_SUBVERSION=$(date +%Y%m%d-%H%M%S)
|
|
||||||
echo "latest-${CURRENT_SUBVERSION}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 构建amd64架构镜像
|
|
||||||
build() {
|
|
||||||
local TAG=${1:-$(get_image_tag)}
|
|
||||||
echo "Building image ${IMAGE_NAME}:${TAG} (linux/amd64)"
|
|
||||||
|
|
||||||
podman build --platform linux/amd64 \
|
|
||||||
--progress plain --force-rm \
|
|
||||||
--build-arg REGISTRY_URL=${REGISTRY_URL} \
|
|
||||||
--build-arg APT_SOURCE=${APT_SOURCE} \
|
|
||||||
--build-arg LOCAL_URL=http://pkgs.colovu.com/dist \
|
|
||||||
-t ${IMAGE_NAME}:${TAG} \
|
|
||||||
-t ${IMAGE_NAME}:latest \
|
|
||||||
.
|
|
||||||
|
|
||||||
echo "Build complete"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 推送镜像到colovu仓库
|
|
||||||
push_colovu() {
|
|
||||||
local TAG=${1:-$(get_image_tag)}
|
|
||||||
echo "Pushing ${IMAGE_NAME}:${TAG} to registry.colovu.com"
|
|
||||||
|
|
||||||
podman tag "${IMAGE_NAME}:${TAG}" "registry.colovu.com/library/${IMAGE_NAME}:${TAG}"
|
|
||||||
podman push "registry.colovu.com/library/${IMAGE_NAME}:${TAG}"
|
|
||||||
|
|
||||||
podman tag "${IMAGE_NAME}:latest" "registry.colovu.com/library/${IMAGE_NAME}:latest"
|
|
||||||
podman push "registry.colovu.com/library/${IMAGE_NAME}:latest"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 推送镜像到华为云仓库
|
|
||||||
push_huawei() {
|
|
||||||
local TAG=${1:-$(get_release_tag)}
|
|
||||||
echo "Pushing ${IMAGE_NAME}:${TAG} to swr.cn-north-4.myhuaweicloud.com"
|
|
||||||
|
|
||||||
podman tag "${IMAGE_NAME}:${TAG}" "swr.cn-north-4.myhuaweicloud.com/colovu/${IMAGE_NAME}:${TAG}"
|
|
||||||
podman push "swr.cn-north-4.myhuaweicloud.com/colovu/${IMAGE_NAME}:${TAG}"
|
|
||||||
|
|
||||||
podman tag "${IMAGE_NAME}:latest" "swr.cn-north-4.myhuaweicloud.com/colovu/${IMAGE_NAME}:latest"
|
|
||||||
podman push "swr.cn-north-4.myhuaweicloud.com/colovu/${IMAGE_NAME}:latest"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 清理工作空间
|
|
||||||
clean() {
|
|
||||||
echo "Cleaning workspace..."
|
|
||||||
podman images | grep "${IMAGE_NAME} " | awk '{print $3}' | xargs -L 1 podman rmi -f
|
|
||||||
podman ps -a | grep "Exited" | awk '{print $1}' | xargs -L 1 podman rm
|
|
||||||
podman images | grep '<none>' | awk '{print $3}' | xargs -L 1 podman rmi -f
|
|
||||||
}
|
|
||||||
|
|
||||||
# 主函数中更新使用说明
|
|
||||||
main() {
|
|
||||||
case "$1" in
|
|
||||||
build) build "$2" ;; # 传递第二个参数作为标签
|
|
||||||
clean) clean ;;
|
|
||||||
push-cv) push_colovu "$2" ;;
|
|
||||||
push-hw) push_huawei "$2" ;;
|
|
||||||
push) push_colovu "$2"; push_huawei "$2" ;;
|
|
||||||
*) echo "Usage: $0 {build [tag]|clean|push-cv [tag]|push-hw [tag]|push [tag]}"; exit 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||||
|
URIs: http://mirrors.aliyun.com/debian
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||||
|
URIs: http://mirrors.aliyun.com/debian-security
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||||
|
URIs: http://deb.debian.org/debian
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||||
|
URIs: http://deb.debian.org/debian-security
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian/20230703T000000Z
|
||||||
|
URIs: http://mirrors.ustc.edu.cn/debian
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
# http://snapshot.debian.org/archive/debian-security/20230703T000000Z
|
||||||
|
URIs: http://mirrors.ustc.edu.cn/debian-security
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
Reference in New Issue
Block a user