Quellcode durchsuchen

Fix docker/rebuild.sh script

Danilo Bargen vor 6 Jahren
Ursprung
Commit
06a3d27482
1 geänderte Dateien mit 17 neuen und 5 gelöschten Zeilen
  1. 17 5
      docker/rebuild.sh

+ 17 - 5
docker/rebuild.sh

@@ -21,25 +21,37 @@ else
     DOCKER="docker"
 fi
 
-echo "Logging in:"
+echo "Logging in..."
 $DOCKER login -u $DOCKER_USER -p $DOCKER_API_KEY
 
+echo "Create temporary directory..."
+mkdir builds
+
 echo -e "\nBuilding branches:"
 for branch in $SUPPORTED_BRANCH_NAMES; do
     echo -e "\n- $branch"
+    git clone -b $branch . "builds/$branch"
+    cd "builds/$branch"
     $DOCKER build . --no-cache -t $IMAGE_NAME:$branch
+    $DOCKER push $IMAGE_NAME:$branch
+    cd ../..
+    rm -rf "builds/$branch"
 done
 
 echo -e "\nBuilding tags:"
 for pattern in $SUPPORTED_TAG_PATTERNS; do
     for tag in $(git tag | grep $pattern); do
         echo -e "\n- $tag"
+        git clone -b $tag . "builds/$tag"
+        cd "builds/$tag"
         maintag=$tag
         minortag=$(echo $tag | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
         majortag=$(echo $tag | sed 's/^\(v[0-9]*\)\..*$/\1/')
-        $DOCKER build . --no-cache -t $IMAGE_NAME:$tag -t $IMAGE_NAME:$minortag -t threema/threema
+        $DOCKER build . --no-cache -t $IMAGE_NAME:$tag -t $IMAGE_NAME:$minortag -t $IMAGE_NAME:$majortag
+        $DOCKER push $IMAGE_NAME:$tag
+        $DOCKER push $IMAGE_NAME:$minortag
+        $DOCKER push $IMAGE_NAME:$majortag
+        cd ../..
+        rm -rf "builds/$tag"
     done
 done
-
-echo -e "\nPushing image with all tags"
-$DOCKER push $IMAGE_NAME