Files
devcontainers/build/build-image.sh
2026-02-16 15:02:44 +08:00

38 lines
924 B
Bash

#!/bin/bash
set -eux
export BUILDX_BUILDER=hk-builder
export REGISTRY="registry.yqxpro.com"
export S3_ENDPOINT_URL=https://oss-cn-hongkong-internal.aliyuncs.com
export S3_REGION=cn-hongkong
export S3_BUCKET=hk-builder-cache-yqxpro
export S3_ACCESSKEY=LTAI5t8AtjWfsqQWYnyBeCjH
export S3_SECRETKEY=UPKF20AmcW2zB5BwAMIQeQgZeTkMEs
export S3_CONFIG=endpoint_url=${S3_ENDPOINT_URL},region=${S3_REGION},bucket=${S3_BUCKET},access_key_id=${S3_ACCESSKEY},secret_access_key=${S3_SECRETKEY}
build() {
local target="$1"
echo "Build $target started"
pushd $target
npx devcontainer build \
--platform linux/amd64,linux/arm64 \
--image-name ${REGISTRY}/devcontainers/$target --push \
--cache-to type=s3,${S3_CONFIG},prefix=$target/,mode=max \
--cache-from type=s3,${S3_CONFIG},prefix=$target/
popd
echo "Build $target completed"
}
main() {
for target in "$@"; do
build "$target"
done
}
main "$@"