builders.sh: fix a couple of bugs
The initial version of the builders script had some bugs in it.
First, the s3 cp was creating another "misra-dockerfiles" subdirectory
and copying the down an extra level instead of overlaying them onto
the contents of the misra-dockerfils.git repo. This could cause the
build to error out when of the files from S3 were referenced in the
Dockerfile.
Also, the "$image" variable includes the prefix "./" which makes it
unsuitable to use for the tagname, so let's create a tag variable
using the last item of the path only by running basename on it.
Change-Id: I559211cf5c370a9e1785efd3c59a3c79b64581e5
diff --git a/misra-docker-images/builders.sh b/misra-docker-images/builders.sh
index 0d69eed..bf31964 100644
--- a/misra-docker-images/builders.sh
+++ b/misra-docker-images/builders.sh
@@ -17,20 +17,21 @@
export ECR=987685672616.dkr.ecr.us-east-1.amazonaws.com
# we are expecting private files to be kept in the dockerfiles/*
# subdirs with a matching name for the image
-aws s3 cp --recursive s3://trustedfirmware-misra/dockerfiles/ ./misra-dockerfiles
-find ./misra-dockerfiles
+aws s3 cp --recursive s3://trustedfirmware-misra/dockerfiles/ .
+find .
aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
for image in ./*
do
+ tag=$(basename $image)
test -d $image && test -f $image/build.sh && \
(
set -ex
- echo "Building image: misra:${image}"
+ echo "Building image: misra:${tag}"
cd $image
./build.sh
- echo "Upoading image: misra:${image}"
- docker push $ECR/misra:$image
+ echo "Upoading image: misra:${tag}"
+ docker push $ECR/misra:$tag
)
done