diff --git a/templates/cicd/buildspec.yml b/templates/cicd/buildspec.yml index fdee0be4e75..38361082730 100644 --- a/templates/cicd/buildspec.yml +++ b/templates/cicd/buildspec.yml @@ -54,9 +54,10 @@ phases: # - Login and push the image. - > for app in $apps; do - for docker_dir in $(cat $CODEBUILD_SRC_DIR/ecs-project/$app/manifest.yml | ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' | jq '.image.build' | sed 's/"//g'); do - cd $CODEBUILD_SRC_DIR/$docker_dir; - docker build -t $app:$tag .; + for df_rel_path in $(cat $CODEBUILD_SRC_DIR/ecs-project/$app/manifest.yml | ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' | jq '.image.build' | sed 's/"//g'); do + df_path=$CODEBUILD_SRC_DIR/$df_rel_path + df_dir_path=$(dirname "$df_path") + docker build -t $app:$tag -f $df_path $df_dir_path; image_id=$(docker images -q $app:$tag); for env in $envs; do repo=$(cat $CODEBUILD_SRC_DIR/infrastructure/$app-$env.params.json | jq '.Parameters.ContainerImage' | sed 's/"//g');