Skip to content

Commit 6efd220

Browse files
Add build args (#16)
* Added build args * Update README.md and docs (#17) Co-authored-by: goruha <[email protected]> Co-authored-by: Cloud Posse Bot (CI/CD) <[email protected]> Co-authored-by: goruha <[email protected]>
1 parent 8f5926c commit 6efd220

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

.github/workflows/test-docker-build-complex.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
registry: registry.hub.docker.com
3232
login: ${{ secrets.DOCKERHUB_USERNAME }}
3333
password: ${{ secrets.DOCKERHUB_PASSWORD }}
34+
build-args: |
35+
TEST_ARG=test_value
36+
SECOND_ARG=two
3437
3538
- uses: nick-fields/assert-action@v1
3639
with:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Build Docker image and push it.
106106
107107
| Name | Description | Default | Required |
108108
|------|-------------|---------|----------|
109+
| build-args | List of build-time variables | N/A | false |
109110
| file | Dockerfile name | Dockerfile | false |
110111
| login | Docker login | | false |
111112
| organization | Organization | N/A | true |

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
description: 'Dockerfile name'
1414
required: false
1515
default: 'Dockerfile'
16+
build-args:
17+
description: "List of build-time variables"
18+
required: false
1619
organization:
1720
description: 'Organization'
1821
required: true
@@ -72,6 +75,7 @@ runs:
7275
file: ${{ inputs.workdir }}/${{ inputs.file }}
7376
pull: true
7477
push: true
78+
build-args: ${{ inputs.build-args }}
7579
cache-from: type=gha
7680
cache-to: type=gha,mode=max
7781
tags: ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}:${{ steps.context.outputs.tag }}

docs/github-action.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Default | Required |
55
|------|-------------|---------|----------|
6+
| build-args | List of build-time variables | N/A | false |
67
| file | Dockerfile name | Dockerfile | false |
78
| login | Docker login | | false |
89
| organization | Organization | N/A | true |

test/custom/Dockerfile_complex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
FROM nginx:1.23.0-alpine
1+
FROM nginx:1.23.0-alpine
2+
3+
ARG TEST_ARG
4+
RUN test "test_value" = "$TEST_ARG"
5+
6+
ARG SECOND_ARG
7+
RUN test "two" = "$SECOND_ARG"
8+

0 commit comments

Comments
 (0)