修正构建脚本
This commit is contained in:
14
Makefile
14
Makefile
@@ -9,25 +9,19 @@ GIT_SHA := $(shell git rev-parse --short HEAD)
|
|||||||
# 定义所有需要构建的子目录
|
# 定义所有需要构建的子目录
|
||||||
SUBDIRS = common-base develop-base universal-base
|
SUBDIRS = common-base develop-base universal-base
|
||||||
|
|
||||||
# 默认目标:按顺序构建所有子目录
|
|
||||||
all: $(SUBDIRS)
|
|
||||||
|
|
||||||
# 模式规则:每个目录目标都依赖对应的目录
|
|
||||||
%: %/
|
|
||||||
@echo "Building $@ Finished"
|
|
||||||
|
|
||||||
# 目录构建规则
|
# 目录构建规则
|
||||||
%/:
|
$(SUBDIRS):
|
||||||
@echo "Building $@..."
|
@echo "Building $@..."
|
||||||
@pushd $@ && \
|
@pushd $@ && \
|
||||||
npx devcontainer build \
|
npx devcontainer build \
|
||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
--image-name $(REGISTRY_LOCAL)/devcontainers/$@ --push \
|
--image-name $(REGISTRY_LOCAL)/devcontainers/$@ \
|
||||||
--cache-to type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache,mode=max \
|
--cache-to type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache,mode=max \
|
||||||
--cache-from type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache && \
|
--cache-from type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache && \
|
||||||
docker tag $(REGISTRY_LOCAL)/devcontainers/$@ $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \
|
docker tag $(REGISTRY_LOCAL)/devcontainers/$@ $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \
|
||||||
|
docker push $(REGISTRY_LOCAL)/devcontainers/$@ && \
|
||||||
docker push $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \
|
docker push $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# 伪目标声明
|
# 伪目标声明
|
||||||
.PHONY: all parallel clean $(SUBDIRS)
|
.PHONY: all $(SUBDIRS)
|
||||||
|
|||||||
Reference in New Issue
Block a user