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