feat: 本地编译脚本增加main/master分支的识别
This commit is contained in:
@@ -9,30 +9,28 @@ image_name :=colovu/abuilder
|
||||
REGISTRY_URL :=docker.colovu.com
|
||||
|
||||
# 定义系统默认使用的源服务器,包含:default / ustc / aliyun
|
||||
APT_SOURCE :=aliyun
|
||||
# 当前 Alpine 3.18 阿里云缺少部分软件包
|
||||
APT_SOURCE :=ustc
|
||||
|
||||
# 定义镜像TAG,类似:
|
||||
# <镜像名>:<分支名>-<7位Git ID> # Git 仓库且无文件修改直接编译
|
||||
# <镜像名>:<分支名>-<年月日>-<时分秒> # Git 仓库有文件修改后的编译
|
||||
# <镜像名>:latest-<年月日>-<时分秒> # 非 Git 仓库编译
|
||||
# <镜像名>:<分支名>-<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/'; else echo "latest"; fi)-$(current_subversion)
|
||||
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=https://local.colovu.com/dist
|
||||
build-arg+=--build-arg LOCAL_URL=http://local.colovu.com/dist
|
||||
|
||||
.PHONY: build clean clearclean upgrade
|
||||
|
||||
# 屏蔽 "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them"
|
||||
export DOCKER_SCAN_SUGGEST=false
|
||||
|
||||
build:
|
||||
@echo "Build $(image_name):$(image_tag)"
|
||||
@docker buildx build --force-rm $(build-arg) -t $(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"
|
||||
|
||||
Reference in New Issue
Block a user