Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
VaultVulp committed Feb 5, 2023
2 parents 2f0c8ac + e0c1984 commit 3c0a6ca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
15 changes: 10 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ inputs:
description: 'Pull the image before buiding it'
default: "false"
required: false
custom-args:
description: 'Any additional docker build arguments as a string'
default: ""
required: false
additional-image-tags:
description: 'Multiple tags that will be attached to a built image'
default: ""
required: false
image-platform:
description: 'Target image platform/platforms'
default: ""
required: false
custom-args:
description: 'Any additional docker build arguments as a string'
default: ""
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -46,8 +50,9 @@ runs:
- ${{ inputs.dockerfile }}
- ${{ inputs.build-context}}
- ${{ inputs.pull-image}}
- ${{ inputs.custom-args}}
- ${{ inputs.additional-image-tags}}
- ${{ inputs.image-platform}}
- ${{ inputs.custom-args}}
branding:
icon: 'box'
color: 'blue'
22 changes: 17 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ EXTRACT_TAG_FROM_GIT_REF=$4
DOCKERFILE=$5
BUILD_CONTEXT=$6
PULL_IMAGE=$7
CUSTOM_DOCKER_BUILD_ARGS=$8
DOCKER_IMAGE_TAGS=$9
DOCKER_IMAGE_TAGS=$8
DOCKER_IMAGE_PLATFORM=$9
CUSTOM_DOCKER_BUILD_ARGS=${10}

if [ $EXTRACT_TAG_FROM_GIT_REF == "true" ]; then
DOCKER_IMAGE_TAG=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g")
Expand All @@ -17,10 +18,16 @@ fi
DOCKER_IMAGE_NAME=$(echo ghcr.io/${GITHUB_REPOSITORY}/${DOCKER_IMAGE_NAME} | tr '[:upper:]' '[:lower:]')
DOCKER_IMAGE_NAME_WITH_TAG=$(echo ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} | tr '[:upper:]' '[:lower:]')

docker buildx create --use # Creating builder instance to support cross-platform builds

docker login -u publisher -p ${DOCKER_TOKEN} ghcr.io

if [ $PULL_IMAGE == "true" ]; then
docker pull $DOCKER_IMAGE_NAME_WITH_TAG || docker pull $DOCKER_IMAGE_NAME || 1
if [ $DOCKER_IMAGE_PLATFORM != "" ]; then
docker pull $DOCKER_IMAGE_NAME_WITH_TAG --platform $DOCKER_IMAGE_PLATFORM || docker pull $DOCKER_IMAGE_NAME --platform $DOCKER_IMAGE_PLATFORM || true
else
docker pull $DOCKER_IMAGE_NAME_WITH_TAG || docker pull $DOCKER_IMAGE_NAME || true
fi
fi

set -- -t $DOCKER_IMAGE_NAME_WITH_TAG
Expand All @@ -29,8 +36,12 @@ if [ $DOCKERFILE != "Dockerfile" ]; then
set -- "$@" -f $DOCKERFILE
fi

if [ $DOCKER_IMAGE_PLATFORM != "" ]; then
set -- "$@" --platform $DOCKER_IMAGE_PLATFORM
fi

if [ $CUSTOM_DOCKER_BUILD_ARGS != "" ]; then
set -- "$@" $CUSTOM_DOCKER_BUILD_ARGS
set -- "$@" $CUSTOM_DOCKER_BUILD_ARGS
fi

set -- "$@" $BUILD_CONTEXT
Expand All @@ -41,5 +52,6 @@ do
set -- -t $DOCKER_IMAGE_NAME_WITH_TAG "$@"
done

docker buildx create --use # Creating builder instance to support cross-platform builds
echo "$@"

docker buildx build --push "$@"

0 comments on commit 3c0a6ca

Please sign in to comment.