Created
October 26, 2024 18:02
-
-
Save avtar/bc97382db0d7c4da5ca647b1bb8e64f4 to your computer and use it in GitHub Desktop.
Revisions
-
avtar created this gist
Oct 26, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/sh set -e total_time=0 for i in 1 2 3 do echo "==> Cleaning up Docker environment before build #$i..." docker system prune --all --volumes --force > /dev/null 2>&1 echo "==> Running build #$i..." start_time=$(date +%s) docker build --platform linux/amd64 . > /dev/null 2>&1 end_time=$(date +%s) elapsed_time=$((end_time - start_time)) echo "==> Time taken for build #$i: ${elapsed_time}s" total_time=$((total_time + elapsed_time)) done average_time=$((total_time / 3)) git_hash=$(git log -n 1 --pretty=format:"%h" -- Dockerfile) echo "" echo "==> Dockerfile $git_hash average build time: ${average_time}s"