fvp-docker-images/builders.sh: introduce script to generate fvp docker images

The builders script is a copy of [1] but placing it into the production
tf-ci-scripts repository. Script makes uses of fvp-dockerfiles
repository [2] which handles the dockerfile generation.

Ultimately, produced docker images are pushed in the corresponding
registry, where LAVA fetchs it on a regular basis and use in job testing.

[1] https://git.trustedfirmware.org/next/ci/tf-ci-scripts.git/tree/fvp-docker-images/builders.sh
[2] https://git.trustedfirmware.org/ci/fvp-dockerfiles.git/

Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
Change-Id: I6df3bfd9a24505d9132c2eaf95c2408f39f4b6cb
diff --git a/fvp-docker-images/builders.sh b/fvp-docker-images/builders.sh
new file mode 100644
index 0000000..0645356
--- /dev/null
+++ b/fvp-docker-images/builders.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+if ! type aws
+then
+    sudo apt-get -y -qq update
+    sudo apt-get -y -qq install --no-install-recommends unzip
+    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
+    unzip awscliv2.zip
+    sudo ./aws/install
+fi
+
+rm -rf fvp-dockerfiles
+git clone https://git.trustedfirmware.org/ci/fvp-dockerfiles.git
+cd fvp-dockerfiles
+
+aws configure list
+ECR=987685672616.dkr.ecr.us-east-1.amazonaws.com
+aws s3 cp --recursive s3://trustedfirmware-fvp/ .
+aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
+
+
+for tarball in F*.tgz
+do
+    tag=$(./create-model-tag.sh $tarball)
+    mkdir -p $tag
+    cp setup-sshd $tag/
+    mv $tarball $tag/
+    ./create-model-dockerfile.sh $tarball $tag
+    (
+        set -ex
+        cd $tag
+        docker build --tag $ECR/fvp:$tag .
+        echo "Docker image created" && \
+        echo "Docker image name: fvp:$${tag}"
+        docker push $ECR/fvp:$tag
+    )
+
+done
+