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