diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 654f5c7..9e6673a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: with: login_username: ${{ secrets.DOCKERHUB_USERNAME }} login_password: ${{ secrets.DOCKERHUB_TOKEN }} + build_push: false + build_file: ./docker-build-push/Dockerfile # - name: Check Docker image # run: | # set -x diff --git a/docker-build-push/Dockerfile b/docker-build-push/Dockerfile new file mode 100644 index 0000000..9d1491c --- /dev/null +++ b/docker-build-push/Dockerfile @@ -0,0 +1 @@ +FROM alpine:latest \ No newline at end of file diff --git a/docker-build-push/action.yml b/docker-build-push/action.yml index 10e2380..e2a450a 100644 --- a/docker-build-push/action.yml +++ b/docker-build-push/action.yml @@ -4,13 +4,29 @@ inputs: login_repository: description: "docker/login-action 的 registry 参数" default: "docker.io" - required: true + required: false login_username: description: "docker/login-action 的 username 参数" required: true login_password: description: "docker/login-action 的 password 参数" required: true + build_file: + description: "Dockerfile 文件路径" + default: "./Dockerfile" + required: false + build_context: + description: "Docker 构建上下文路径" + default: "." + required: false + build_platforms: + description: "Docker 构建平台" + default: "linux/amd64,linux/arm64" + required: false + build_push: + description: "是否推送 Docker 镜像" + default: "true" + required: false runs: using: "composite" steps: @@ -31,11 +47,11 @@ runs: - name: Build and push uses: docker/build-push-action@v6 with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - file: ./Dockerfile + file: ${{ inputs.build_file }} + context: ${{ inputs.build_context }} + platforms: ${{ inputs.build_platforms }} + push: ${{ inputs.build_push }} + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file