3
0
Fork 0
mirror of https://gitea.com/docker/build-push-action.git synced 2024-11-25 10:59:38 +01:00

use default docker command line values for file when it is missing

Signed-off-by: Libo Zeng <libo@mabl.com>
This commit is contained in:
Libo Zeng 2020-12-18 10:05:47 -05:00
parent f2a733f179
commit a8587cb818
5 changed files with 3 additions and 12 deletions

View file

@ -608,7 +608,7 @@ Following inputs can be used as `step.with` keys
|---------------------|----------|------------------------------------| |---------------------|----------|------------------------------------|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) | | `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) | | `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
| `file` | String | Path to the Dockerfile (default `./Dockerfile`) | | `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
| `build-args` | List | List of build-time variables | | `build-args` | List | List of build-time variables |
| `labels` | List | List of metadata for an image | | `labels` | List | List of metadata for an image |
| `tags` | List/CSV | List of tags | | `tags` | List/CSV | List of tags |

View file

@ -147,7 +147,6 @@ describe('getArgs', () => {
'buildx', 'buildx',
'build', 'build',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--file', 'Dockerfile',
'.' '.'
] ]
], ],
@ -162,7 +161,6 @@ describe('getArgs', () => {
'--build-arg', 'MY_ARG=val1,val2,val3', '--build-arg', 'MY_ARG=val1,val2,val3',
'--build-arg', 'ARG=val', '--build-arg', 'ARG=val',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--file', 'Dockerfile',
'https://github.com/docker/build-push-action.git#test-jest' 'https://github.com/docker/build-push-action.git#test-jest'
] ]
], ],
@ -177,7 +175,6 @@ describe('getArgs', () => {
'--tag', 'name/app:7.4', '--tag', 'name/app:7.4',
'--tag', 'name/app:latest', '--tag', 'name/app:latest',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--file', 'Dockerfile',
'https://github.com/docker/build-push-action.git#test-jest' 'https://github.com/docker/build-push-action.git#test-jest'
] ]
], ],
@ -194,7 +191,6 @@ describe('getArgs', () => {
'--label', 'org.opencontainers.image.title=buildkit', '--label', 'org.opencontainers.image.title=buildkit',
'--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit', '--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit',
'--output', 'type=local,dest=./release-out', '--output', 'type=local,dest=./release-out',
'--file', 'Dockerfile',
'.' '.'
] ]
], ],
@ -208,7 +204,6 @@ describe('getArgs', () => {
'buildx', 'buildx',
'build', 'build',
'--platform', 'linux/amd64,linux/arm64', '--platform', 'linux/amd64,linux/arm64',
'--file', 'Dockerfile',
'.' '.'
] ]
], ],
@ -221,7 +216,6 @@ describe('getArgs', () => {
'buildx', 'buildx',
'build', 'build',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--file', 'Dockerfile',
'.' '.'
] ]
], ],
@ -236,7 +230,6 @@ describe('getArgs', () => {
'build', 'build',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest', '--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--file', 'Dockerfile',
'.' '.'
] ]
], ],
@ -251,7 +244,6 @@ describe('getArgs', () => {
'build', 'build',
'--output', '.', '--output', '.',
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest', '--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--file', 'Dockerfile',
'https://github.com/docker/build-push-action.git#test-jest' 'https://github.com/docker/build-push-action.git#test-jest'
] ]
], ],

View file

@ -16,7 +16,6 @@ inputs:
file: file:
description: "Path to the Dockerfile" description: "Path to the Dockerfile"
required: false required: false
default: './Dockerfile'
build-args: build-args:
description: "List of build-time variables" description: "List of build-time variables"
required: false required: false

2
dist/index.js generated vendored
View file

@ -12987,7 +12987,7 @@ function getInputs(defaultContext) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return { return {
context: core.getInput('context') || defaultContext, context: core.getInput('context') || defaultContext,
file: core.getInput('file') || 'Dockerfile', file: core.getInput('file'),
buildArgs: yield getInputList('build-args', true), buildArgs: yield getInputList('build-args', true),
labels: yield getInputList('labels', true), labels: yield getInputList('labels', true),
tags: yield getInputList('tags'), tags: yield getInputList('tags'),

View file

@ -57,7 +57,7 @@ export function tmpNameSync(options?: tmp.TmpNameOptions): string {
export async function getInputs(defaultContext: string): Promise<Inputs> { export async function getInputs(defaultContext: string): Promise<Inputs> {
return { return {
context: core.getInput('context') || defaultContext, context: core.getInput('context') || defaultContext,
file: core.getInput('file') || 'Dockerfile', file: core.getInput('file'),
buildArgs: await getInputList('build-args', true), buildArgs: await getInputList('build-args', true),
labels: await getInputList('labels', true), labels: await getInputList('labels', true),
tags: await getInputList('tags'), tags: await getInputList('tags'),