build add proxy

This commit is contained in:
xRain 2024-12-11 06:58:45 +08:00
parent 828a6f63db
commit a4901d4de4

View File

@ -4,31 +4,39 @@ inputs:
registry:
description: 'Docker registry URL'
required: true
default: '${{ vars.DOCKER_REGISTRY }}' # 使用原 vars 值作为默认值
default: '${{ vars.DOCKER_REGISTRY }}'
user:
description: 'Docker registry username'
required: true
default: '${{ vars.DOCKER_USER }}' # 使用原 vars 值作为默认值
default: '${{ vars.DOCKER_USER }}'
pass:
description: 'Docker registry password'
required: true
default: '${{ vars.DOCKER_PASS }}' # 使用原 vars 值作为默认值
default: '${{ vars.DOCKER_PASS }}'
image:
description: 'Docker image name'
required: true
default: '${{ github.repository }}' # 使用 GitHub 仓库名称作为默认值
default: '${{ github.repository }}'
tag:
description: 'Docker image tag (default: main)'
required: false
default: '${{ github.ref_name }}' # 使用 GitHub 分支名称作为默认值
default: '${{ github.ref_name }}'
platform:
description: 'Build platform (default: linux/amd64)'
required: false
default: 'linux/amd64' # 默认构建平台为 x86
default: 'linux/amd64'
dockerfile:
description: 'Path to the Dockerfile (default: Dockerfile)'
required: false
default: 'Dockerfile' # 默认 Dockerfile 名称
default: 'Dockerfile'
proxy:
description: 'Proxy URL'
required: false
default: 'http://100.100.13.14:8118' # 默认代理
no_proxy:
description: 'No proxy addresses'
required: false
default: '192.168.0.0/24,192.168.1.0/24,*.simcu.com,*.coce.ink,*.coce.cc' # 默认不使用代理的地址
runs:
using: 'composite'
@ -37,6 +45,9 @@ runs:
uses: docker://docker:git
env:
DOCKER_BUILDKIT: 1
HTTPS_PROXY: ${{ inputs.proxy }} # 设置 HTTPS 代理
HTTP_PROXY: ${{ inputs.proxy }} # 设置 HTTPS 代理
NO_PROXY: ${{ inputs.no_proxy }} # 设置不使用代理的地址
with:
entrypoint: "/bin/sh"
args: |