From 115fa86023892df70ba891424af545b44fa1b4ad Mon Sep 17 00:00:00 2001 From: Donavan Fritz Date: Wed, 27 May 2026 13:07:11 -0500 Subject: [PATCH] add dockerfile input for monorepos Lets a caller point at a non-default Dockerfile while keeping the build context broader. Needed for repos with multiple binaries sharing internal packages (api/Dockerfile + worker/Dockerfile, build context at repo root). Empty default preserves prior behavior. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 1 + action.yaml | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index f3ba68e..4516edd 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ the same tag. |---|---|---|---| | `image` | yes | — | Full image name without tag (e.g. `code.fritzlab.net/fritzlab/chrony`). | | `context` | no | `.` | Docker build context. | +| `dockerfile` | no | `Dockerfile` (in context) | Path to the Dockerfile, relative to the context (or absolute under `$GITHUB_WORKSPACE`). Use for monorepos where the build context is the repo root but the Dockerfile lives in a subdir, e.g. `dockerfile: api/Dockerfile`. | | `build-args` | no | — | Multiline `KEY=VALUE` build args. | | `smoke-test` | no | — | Shell command run after build. `$IMAGE` is set to `:`. Non-zero exit fails the action. | diff --git a/action.yaml b/action.yaml index b63d4a2..059b5a7 100644 --- a/action.yaml +++ b/action.yaml @@ -8,6 +8,14 @@ inputs: description: Docker build context path required: false default: . + dockerfile: + description: | + Path to the Dockerfile, relative to the context (or absolute under + $GITHUB_WORKSPACE). Defaults to "Dockerfile" inside the context. + Use this for monorepos where the build context is the repo root but + the Dockerfile lives in a subdir (e.g. dockerfile: api/Dockerfile). + required: false + default: '' build-args: description: Multiline KEY=VALUE pairs passed to docker build required: false @@ -29,6 +37,7 @@ runs: uses: docker/build-push-action@v6 with: context: ${{ inputs.context }} + file: ${{ inputs.dockerfile }} push: false load: true provenance: false