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

dockerfile input: allow docker build --file to be customized #13

Merged
merged 6 commits into from
Nov 22, 2021
Merged
Changes from 1 commit
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
Next Next commit
dockerfile input: allow docker build --file to be customized
macbre authored Nov 22, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5cf0450e578c5fc6f8a60f65eabb1da7dc99a7e7
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@ inputs:
description: "Image name, e.g. my-user-name/my-repo"
required: true

dockerfile:
description: "A path to the Dockerfile (if it's not in the repository's root directory)"
required: false
default: "./Dockerfile"

repository:
description: "Docker repository to push an image to, defaults to ghcr.io"
required: true
@@ -56,11 +61,12 @@ 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 }}/${{ inputs.image_name }}:${COMMIT_TAG} ..."
echo "::group::Building the Docker image: ${{ inputs.repository }}/${{ inputs.image_name }}:${COMMIT_TAG} from ${{ inputs.dockerfile }}..."

# https://docs.docker.com/develop/develop-images/build_enhancements/
# https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
>&0 docker build . \
--file ${{ inputs.dockerfile }} \
--progress tty \
--cache-from ${{ inputs.repository }}/${{ inputs.image_name }}:latest \
--build-arg BUILDKIT_INLINE_CACHE=1 \