name: 'build docker image and push to registry (default: code)' inputs: registry: description: 'Docker registry URL' required: true default: '${{ vars.DOCKER_REGISTRY }}' user: description: 'Docker registry username' required: true default: '${{ vars.DOCKER_USER }}' pass: description: 'Docker registry password' required: true default: '${{ vars.DOCKER_PASS }}' image: description: 'Docker image name' required: true default: '${{ github.repository }}' tag: description: 'Docker image tag (default: main)' required: false default: '${{ github.ref_name }}' platform: description: 'Build platform (default: linux/amd64)' required: false default: 'linux/amd64' dockerfile: description: 'Path to the Dockerfile (default: Dockerfile)' required: false 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' steps: - name: build docker image 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: | -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 }} 推送成功'