Files
devcontainers/Makefile
2026-02-14 17:39:55 +08:00

26 lines
772 B
Makefile

# 切换到 bash
SHELL := /bin/bash
# 定义变量
REGISTRY_LOCAL ?= localhost:5000
REGISTRY ?= crpi-kbfsbvlqwt19zxum-vpc.cn-hongkong.personal.cr.aliyuncs.com/registry-yqxpro
GIT_SHA := $(shell git rev-parse --short HEAD)
# 定义所有需要构建的子目录
SUBDIRS = common-base develop-base universal-base
# 目录构建规则
$(SUBDIRS):
@echo "Building $@..."
@pushd $@ && \
npx devcontainer build \
--platform linux/amd64,linux/arm64 \
--image-name $(REGISTRY_LOCAL)/devcontainers/$@ \
--cache-to type=local,dest=$(HOME)/docker-buildcache/devcontainers/$@,mode=max \
--cache-from type=local,src=$(HOME)/docker-buildcache/devcontainers/$@ && \
docker push $(REGISTRY_LOCAL)/devcontainers/$@ &&\
popd
# 伪目标声明
.PHONY: all $(SUBDIRS)