This commit is contained in:
parent
6cecb1a24e
commit
724b920e46
|
|
@ -30,6 +30,9 @@ inputs:
|
|||
platform:
|
||||
description: 要编译的平台,可选值linux/arm,linux/arm64,linux/amd64
|
||||
required: false
|
||||
args:
|
||||
description: 构建参数
|
||||
required: false
|
||||
script:
|
||||
description: 上传完成后执行的脚本
|
||||
required: false
|
||||
|
|
|
|||
|
|
@ -18,21 +18,30 @@ tags=(${INPUT_TAGS//,/ })
|
|||
|
||||
echo $tags
|
||||
|
||||
args=(${INPUT_ARGS//,/ })
|
||||
|
||||
echo $args
|
||||
|
||||
cd $INPUT_CONTEXT
|
||||
|
||||
tmp_image_name=$(uuidgen)
|
||||
tmp_image_name=${tmp_image_name//-/}
|
||||
|
||||
BUILD_ARGS=$' ' printf '--build-arg=%s' "${args[*]}"
|
||||
|
||||
echo $BUILD_ARGS
|
||||
|
||||
if [ -n "$INPUT_PLATFORM" ]; then
|
||||
#开启实验特性
|
||||
DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
|
||||
docker buildx create --platform $INPUT_PLATFORM --use --name build
|
||||
echo "docker buildx build -t $tmp_image_name -f $INPUT_DOCKERFILE --load --platform $INPUT_PLATFORM ."
|
||||
docker buildx build -t $tmp_image_name -f $INPUT_DOCKERFILE --load --platform $INPUT_PLATFORM .
|
||||
docker buildx build $BUILD_ARGS -t $tmp_image_name -f $INPUT_DOCKERFILE --load --platform $INPUT_PLATFORM .
|
||||
else
|
||||
echo "docker build -t $tmp_image_name -f $INPUT_DOCKERFILE ."
|
||||
docker build -t $tmp_image_name -f $INPUT_DOCKERFILE .
|
||||
#--build-arg
|
||||
echo "docker build $BUILD_ARGS -t $tmp_image_name -f $INPUT_DOCKERFILE ."
|
||||
docker build $BUILD_ARGS -t $tmp_image_name -f $INPUT_DOCKERFILE .
|
||||
fi
|
||||
|
||||
if docker images --format "{{.Repository}}:{{.Tag}}" | grep -q $tmp_image_name; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue