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

Adding platform support #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ Following the capabilities of this action:
<td></td>
</tr>

<tr>
<td><code>platform</code><br/></td>
<td>(Optional) Build platform, windows or linux with optional arch variant (/arm/v7). Default to linux </td>
<td></td>
</tr>

</table>

## Example usage
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}