diff --git a/local_builds/README.md b/local_builds/README.md index d333a009..dd086d49 100644 --- a/local_builds/README.md +++ b/local_builds/README.md @@ -36,6 +36,7 @@ Download and use our codebuild_build.sh script to run your local builds. * First `-s` is for primary source * Use additional `-s` in `:` format for secondary source * For `sourceIdentifier`, use a value that is fewer than 128 characters and contains only alphanumeric characters and underscores + * `-f` Used to specify the platform argument to docker command. **Environment variable file format:** * Expects each line to be in VAR=VAL format diff --git a/local_builds/codebuild_build.sh b/local_builds/codebuild_build.sh index b2f75bc8..62cef290 100755 --- a/local_builds/codebuild_build.sh +++ b/local_builds/codebuild_build.sh @@ -52,6 +52,7 @@ function usage { echo " * Blank lines are ignored" echo " * File can be of type .env or .txt" echo " * There is no special handling of quotation marks, meaning they will be part of the VAL" + echo " -f PLATFORM Used to specify the platform argument to docker command." exit 1 } @@ -61,7 +62,7 @@ awsconfig_flag=false mount_src_dir_flag=false docker_privileged_mode_flag=false -while getopts "cmdi:a:r:s:b:e:l:p:h" opt; do +while getopts "cmdi:a:r:s:b:e:l:p:f:h" opt; do case $opt in i ) image_flag=true; image_name=$OPTARG;; a ) artifact_flag=true; artifact_dir=$OPTARG;; @@ -74,6 +75,7 @@ while getopts "cmdi:a:r:s:b:e:l:p:h" opt; do e ) environment_variable_file=$OPTARG;; l ) local_agent_image=$OPTARG;; p ) aws_profile=$OPTARG;; + f ) docker_platform=$OPTARG;; h ) usage; exit;; \? ) echo "Unknown option: -$OPTARG" >&2; exit 1;; : ) echo "Missing option argument for -$OPTARG" >&2; exit 1;; @@ -182,6 +184,11 @@ else docker_command+=" -e \"INITIATOR=$USER\"" fi +if [ -n "$docker_platform" ] +then + docker_command+=" --platform \"$docker_platform\"" +fi + if [ -n "$local_agent_image" ] then docker_command+=" $local_agent_image"