Skip to content

Commit d2eb352

Browse files
authored
Allow specifying the Dockerfile path (#29)
1 parent 5f8d46c commit d2eb352

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
|:---------------------|:------------|:---------|:--------|
4949
| `image-repository` | The Docker image repository to push the build image and cached layers. | Yes | `temporary/my-image` |
5050
| `context` | The Docker build context directory. Defaults to `.`. | No | `./my-image` |
51+
| `dockerfile` | Path to the Dockerfile relative to the [`working-directory`](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsworking-directory). Defaults to `${context}/Dockerfile`. | No | `./my-image.Dockerfile` |
5152
| `build-args` | List of [build-time variables](https://docs.docker.com/reference/cli/docker/buildx/build/#build-arg). | No | <pre><code>HTTP_PROXY=http://10.20.30.2:1234 &#10;FTP_PROXY=http://40.50.60.5:4567</code></pre> |
5253
| `build-secrets` | List of [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build. | No | <pre><code>GIT_AUTH_TOKEN=mytoken</code></pre> |
5354
| `from-scratch` | Do not read from the cache when building the image. Writes to caches will still occur. Defaults to `false`. | No | `false` |

action.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ inputs:
1111
context:
1212
description: The Docker build context directory.
1313
default: "."
14+
dockerfile:
15+
description: >-
16+
Path to the Dockerfile relative to the `working-directory`. Defaults to
17+
`${context}/Dockerfile`.
18+
default: ""
1419
build-args:
1520
description: List of build-time variables.
1621
required: false
@@ -191,8 +196,9 @@ runs:
191196
id: build-push
192197
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
193198
with:
194-
context: ${{ inputs.context }}
195199
builder: ${{ steps.builder.outputs.name }}
200+
context: ${{ inputs.context }}
201+
file: ${{ inputs.dockerfile }}
196202
build-args: ${{ inputs.build-args }}
197203
secrets: ${{ inputs.build-secrets }}
198204
cache-from: ${{ steps.cache.outputs.from-tags }}

0 commit comments

Comments
 (0)