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

pass --platform into docker command #664

Open
wants to merge 3 commits into
base: master
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
1 change: 1 addition & 0 deletions local_builds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<sourceIdentifier>:<sourceLocation>` 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
Expand Down
9 changes: 8 additions & 1 deletion local_builds/codebuild_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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;;
Expand All @@ -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;;
Expand Down Expand Up @@ -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"
Expand Down