feat: 更新临时镜像清理命令

This commit is contained in:
2023-09-06 14:35:49 +08:00
parent 9c721f834b
commit 2e67ecee4b
+9 -10
View File
@@ -13,10 +13,10 @@ variables:
default:
# 各 stage 使用的默认镜像,如果不定义,则为 gitlab-runner 创建时指定的镜像;各 stage 可以覆盖该值以使用不同的镜像
image: docker.colovu.com/library/docker:20.10.16
# Gitlab-runner 配置的执行器为 Docker 时,需要 配置对应的 dind 服务
services:
- name: docker.colovu.com/library/docker:20.10.16-dind
alias: docker
# 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:
- |
@@ -36,7 +36,7 @@ env-variables:
# 编译阶段任务
build-arm64:
stage: build
tags:
tags:
- arm64
script:
- docker buildx build --platform=linux/arm64 --pull -t "$IMG_URL$IMG_TAG-linux-arm64" . --push
@@ -44,7 +44,7 @@ build-arm64:
build-amd64:
stage: build
tags:
tags:
- amd64
script:
- docker buildx build --platform=linux/amd64 --pull -t "$IMG_URL$IMG_TAG-linux-amd64" . --push
@@ -62,10 +62,9 @@ build-artifact:
test:
stage: test
script:
- docker run --rm --platform=linux/arm64 "$IMG_URL$IMG_TAG" /bin/uname -a
- sleep 1 && docker rmi -f "$IMG_URL$IMG_TAG"
- docker run --rm --platform=linux/amd64 "$IMG_URL$IMG_TAG" /bin/uname -a
- sleep 1 && docker rmi -f "$IMG_URL$IMG_TAG"
- 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: