Skip to content

Commit

Permalink
Merge pull request #41 from macbre/add/build-arg
Browse files Browse the repository at this point in the history
Add the optional build-arg input
  • Loading branch information
macbre authored Jun 13, 2024
2 parents 575cc6b + f7be842 commit 91a23f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ inputs:
description: Image tag, e.g. latest. Will overwrite the tag latest tag on a push, and have no effect on a release.
required: false

# https://docs.docker.com/build/guide/build-args/
build_arg:
description: Additional build argument to be passed to the Dockerfile (e.g. NODE_AUTH_TOKEN=s3cr3t)
required: false
default: "FOO=bar"

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -84,7 +90,7 @@ runs:
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export GITHUB_URL=https://github.com/${{ github.repository }}
echo "::group::Building the Docker image: ${{ inputs.repository }}/${IMAGE_NAME}:${COMMIT_TAG} from ${{ inputs.dockerfile }} in ${{ inputs.context}} context ..."
echo "::group::Building the Docker image: ${{ inputs.repository }}/${IMAGE_NAME}:${COMMIT_TAG} from ${{ inputs.dockerfile }} in ${{ inputs.context }} context ..."
# https://docs.docker.com/develop/develop-images/build_enhancements/
# https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
Expand All @@ -97,6 +103,8 @@ runs:
--build-arg BUILD_DATE=${BUILD_DATE} \
--build-arg GITHUB_SHA=${GITHUB_SHA} \
\
--build-arg ${{ inputs.build_arg }} \
\
--tag ${{ inputs.repository }}/${IMAGE_NAME}:${COMMIT_TAG} \
--tag docker.io/${IMAGE_NAME}:${COMMIT_TAG} \
\
Expand Down

0 comments on commit 91a23f5

Please sign in to comment.