Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build-args to define buid-time arguments #6

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [1.1.7] - 2023-08-04
### Added
- Add `build-args` parameter used when building the docker image

## [1.1.6] - 2023-08-04
### Added
- Expose action_sha from the github action when running directly from the checkout
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ To use the action, add the following step to your GitHub Actions workflow:
* `dockerfile`: The Dockerfile path. Optional; defaults to `Dockerfile`.
* `opts`: The Docker run options. Optional.
* `args`: The Docker run args. Optional.
* `build-args`: Additional Docker build args. Optional.
* `working-directory`: The Docker run working directory. Optional; defaults to `${{ github.workspace }}`.
* `github-server-url`: The GitHub server URL. Optional; defaults to `${{ github.server_url }}`.
* `docker-registry-url`: The Docker registry URL. Optional; defaults to `https://ghcr.io`.
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inputs:
args:
description: 'The docker run args'
required: false
build-args:
description: 'The docker build args'
required: false
working-directory:
description: 'The docker run working directory'
required: false
Expand Down Expand Up @@ -62,7 +65,10 @@ runs:
GITHUB_SERVER_URL: ${{ inputs.github-server-url }}
DOCKER_REGISTRY_URL: ${{ inputs.docker-registry-url }}
DOCKER_BUILDKIT: '0' # Using remote git context with buildkit does not support referencing merge commits via SHA
run: docker build -t ${DOCKER_REGISTRY_URL#http*://}/$IMAGE:$TAG -f $DOCKERFILE $GITHUB_SERVER_URL/$REPOSITORY.git#$REF
BUILD_ARGS: ${{ inputs.build-args }}
run: |
docker build -t ${DOCKER_REGISTRY_URL#http*://}/$IMAGE:$TAG -f $DOCKERFILE ${BUILD_ARGS} $GITHUB_SERVER_URL/$REPOSITORY.git#$REF
docker run -t ${DOCKER_REGISTRY_URL#http*://}/$IMAGE:$TAG --version
shell: bash
- id: run
env:
Expand Down
Loading