|
@ -15,7 +15,6 @@ include pretty |
|
|
|
|
|
|
|
|
usage="$exname COMPONENT MASTER_IMAGE_NAME BRANCH UPDATED_IMAGE_NAME" |
|
|
usage="$exname COMPONENT MASTER_IMAGE_NAME BRANCH UPDATED_IMAGE_NAME" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COMPONENT_NAME="$1" |
|
|
COMPONENT_NAME="$1" |
|
|
MASTER_IMAGE_NAME="$2" |
|
|
MASTER_IMAGE_NAME="$2" |
|
|
BRANCH="$3" |
|
|
BRANCH="$3" |
|
@ -95,30 +94,11 @@ fi |
|
|
# |
|
|
# |
|
|
#echo "Pulling $MASTER_IMAGE_NAME" |
|
|
#echo "Pulling $MASTER_IMAGE_NAME" |
|
|
#docker pull "$MASTER_IMAGE_NAME" || exit 1 |
|
|
#docker pull "$MASTER_IMAGE_NAME" || exit 1 |
|
|
container_id=$( |
|
|
|
|
|
docker run -d \ |
|
|
|
|
|
-v $tmpdir_changes:/mnt/changes \ |
|
|
|
|
|
--entrypoint '/bin/bash' \ |
|
|
|
|
|
"$MASTER_IMAGE_NAME" \ |
|
|
|
|
|
-c " |
|
|
|
|
|
mkdir -p /srv/app/{root,changes} |
|
|
|
|
|
cp -a /mnt/changes /srv/app/changes/0000 |
|
|
|
|
|
ls /srv/app/changes/0000 |
|
|
|
|
|
") |
|
|
|
|
|
if [ "$?" != 0 ]; then |
|
|
|
|
|
echo "Failed to call docker run..." |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
if [ "$(docker wait "$container_id")" != "0" ]; then |
|
|
|
|
|
echo "Copy of changes to docker images failed !" |
|
|
|
|
|
echo "Log of container:" |
|
|
|
|
|
docker logs "$container_id" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
docker commit --author "$exname" \ |
|
|
|
|
|
--message "Automatic Updater" \ |
|
|
|
|
|
"$container_id" \ |
|
|
|
|
|
"$UPDATED_IMAGE_NAME" |
|
|
|
|
|
|
|
|
cat <<EOF | docker-update "$MASTER_IMAGE_NAME" -v "$tmpdir_changes:/mnt/changes" |
|
|
|
|
|
mkdir -p /srv/app/{root,changes} |
|
|
|
|
|
cp -a /mnt/changes /srv/app/changes/0000 |
|
|
|
|
|
ls /srv/app/changes/0000 |
|
|
|
|
|
EOF |
|
|
|
|
|
|
|
|
docker push "$UPDATED_IMAGE_NAME" |
|
|
docker push "$UPDATED_IMAGE_NAME" |