fix
This commit is contained in:
parent
acf2adc625
commit
75d7c316e4
28
action.yml
28
action.yml
@ -1,31 +1,27 @@
|
||||
name: 'build docker image and push to registry (default: code)'
|
||||
|
||||
inputs:
|
||||
docker_registry:
|
||||
registry:
|
||||
description: 'Docker registry URL'
|
||||
required: true
|
||||
default: '${{ vars.DOCKER_REGISTRY }}' # 使用原 vars 值作为默认值
|
||||
docker_user:
|
||||
user:
|
||||
description: 'Docker registry username'
|
||||
required: true
|
||||
default: '${{ vars.DOCKER_USER }}' # 使用原 vars 值作为默认值
|
||||
docker_pass:
|
||||
pass:
|
||||
description: 'Docker registry password'
|
||||
required: true
|
||||
default: '${{ vars.DOCKER_PASS }}' # 使用原 vars 值作为默认值
|
||||
docker_image_name:
|
||||
image:
|
||||
description: 'Docker image name'
|
||||
required: true
|
||||
default: '${{ github.repository }}' # 使用 GitHub 仓库名称作为默认值
|
||||
docker_tag:
|
||||
tag:
|
||||
description: 'Docker image tag (default: main)'
|
||||
required: false
|
||||
default: '${{ github.ref_name }}' # 使用 GitHub 分支名称作为默认值
|
||||
docker_build_args:
|
||||
description: 'Additional build arguments for Docker build'
|
||||
required: false
|
||||
default: ''
|
||||
build_platform:
|
||||
platform:
|
||||
description: 'Build platform (default: linux/amd64)'
|
||||
required: false
|
||||
default: 'linux/amd64' # 默认构建平台为 x86
|
||||
@ -42,9 +38,9 @@ runs:
|
||||
with:
|
||||
entrypoint: "/bin/sh"
|
||||
args: |
|
||||
-c 'docker ps && docker info && docker build --platform ${{ inputs.build_platform }} ${ { inputs.docker_build_args } } -t ${{ inputs.docker_registry }}/${{ inputs.docker_image_name }}:${{ inputs.docker_tag }} -f ${{ inputs.dockerfile }} . && \
|
||||
echo ${{ inputs.docker_registry }}/${{ inputs.docker_image_name }}:${{ inputs.docker_tag }} 已经构建完了 && \
|
||||
echo ${{ inputs.docker_registry }} && \
|
||||
docker login ${{ inputs.docker_registry }} -u ${{ inputs.docker_user }} -p ${{ inputs.docker_pass }} && \
|
||||
docker push ${{ inputs.docker_registry }}/${{ inputs.docker_image_name }}:${{ inputs.docker_tag }} && \
|
||||
echo ${{ inputs.docker_registry }}/${{ inputs.docker_image_name }}:${{ inputs.docker_tag }} 推送成功'
|
||||
-c 'docker ps && docker info && docker build --platform ${{ inputs.platform }} \
|
||||
-t ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.tag }} -f ${{ inputs.dockerfile }} . && \
|
||||
echo ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.tag }} 已经构建完了 && \
|
||||
docker login ${{ inputs.registry }} -u ${{ inputs.user }} -p ${{ inputs.pass }} && \
|
||||
docker push ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.tag }} && \
|
||||
echo ${{ inputs.registry }}/${{ inputs.image }}:${{ inputs.tag }} 推送成功'
|
||||
|
Loading…
Reference in New Issue
Block a user