diff --git a/README.md b/README.md index b375af2..c5b1052 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,12 @@ Following the capabilities of this action: + + platform
+ (Optional) Build platform, windows or linux with optional arch variant (/arm/v7). Default to linux + + + ## Example usage diff --git a/action.yml b/action.yml index ad9d692..6998de0 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,9 @@ inputs: branch: description: "Branch to build from, defaults to master" required: false + platform: + description: "Build platform, windows or linux with optional arch variant (/arm/v7). Default to linux" + required: false folder: description: "The folder in the Github repo that holds the source" required: true diff --git a/entrypoint.sh b/entrypoint.sh index c667c63..2f1d55e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,9 @@ set -e INPUT_DOCKERFILE=${INPUT_DOCKERFILE:-Dockerfile} INPUT_TAG=${INPUT_TAG:-${GITHUB_SHA::8}} INPUT_BRANCH=${INPUT_BRANCH:-master} +INPUT_PLATFORM=${INPUT_PLATFORM:-linux} IMAGE_PART="" + if [ -n "$INPUT_BUILD_ARGS" ]; then BUILD_ARGS=`echo -n ${INPUT_BUILD_ARGS:-''} |jq -j '.[] | keys[] as $k | values[] as $v | "--build-arg \($k)=\"\($v)\" "'` fi @@ -23,4 +25,4 @@ echo "Logging into azure.." az login --service-principal -u ${INPUT_SERVICE_PRINCIPAL} -p ${INPUT_SERVICE_PRINCIPAL_PASSWORD} --tenant ${INPUT_TENANT} echo "Sending build job to ACR.." -az acr build -r ${INPUT_REGISTRY} ${BUILD_ARGS} -f ${INPUT_DOCKERFILE} -t ${INPUT_REPOSITORY}${IMAGE_PART}:${INPUT_TAG} https://${GIT_ACCESS_TOKEN_FLAG}github.com/${GITHUB_REPOSITORY}.git#${INPUT_BRANCH}:${INPUT_FOLDER} +az acr build --platform ${INPUT_PLATFORM} -r ${INPUT_REGISTRY} ${BUILD_ARGS} -f ${INPUT_DOCKERFILE} -t ${INPUT_REPOSITORY}${IMAGE_PART}:${INPUT_TAG} https://${GIT_ACCESS_TOKEN_FLAG}github.com/${GITHUB_REPOSITORY}.git#${INPUT_BRANCH}:${INPUT_FOLDER}