|
|
@ -26,6 +26,25 @@ if [ "$#" -gt 0 ]; then
|
|
|
|
COMPONENTS=("$@")
|
|
|
|
COMPONENTS=("$@")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If CACHE_FROM is set, explicitly pull and re-use specified image versions
|
|
|
|
|
|
|
|
CACHE_IMAGES=()
|
|
|
|
|
|
|
|
CACHE_ARGS=()
|
|
|
|
|
|
|
|
if [ -n "${CACHE_FROM:-}" ]; then
|
|
|
|
|
|
|
|
# Note lack of quotes here - we want to word split
|
|
|
|
|
|
|
|
for commit in $CACHE_FROM; do
|
|
|
|
|
|
|
|
tag=$(git rev-parse --short "$commit")
|
|
|
|
|
|
|
|
for component in "${COMPONENTS[@]}"; do
|
|
|
|
|
|
|
|
CACHE_IMAGES+=("$BASE/wubloader-$component:$tag")
|
|
|
|
|
|
|
|
CACHE_ARGS+=("--cache-from" "$BASE/wubloader-$component:$tag")
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Trying to pull images for commits $CACHE_FROM if they exist, to re-use layers if possible"
|
|
|
|
|
|
|
|
for image in "${CACHE_IMAGES[@]}"; do
|
|
|
|
|
|
|
|
echo "Pulling $image"
|
|
|
|
|
|
|
|
docker pull "$image" || true # don't exit on failure
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for component in "${COMPONENTS[@]}"; do
|
|
|
|
for component in "${COMPONENTS[@]}"; do
|
|
|
|
echo "Building image for $component"
|
|
|
|
echo "Building image for $component"
|
|
|
|
latest="$BASE/wubloader-$component:latest"
|
|
|
|
latest="$BASE/wubloader-$component:latest"
|
|
|
@ -34,6 +53,7 @@ for component in "${COMPONENTS[@]}"; do
|
|
|
|
-f "$component/Dockerfile" \
|
|
|
|
-f "$component/Dockerfile" \
|
|
|
|
-t "$latest" \
|
|
|
|
-t "$latest" \
|
|
|
|
-t "$specific" \
|
|
|
|
-t "$specific" \
|
|
|
|
|
|
|
|
"${CACHE_ARGS[@]}" \
|
|
|
|
.
|
|
|
|
.
|
|
|
|
echo "Built image wubloader-$component:$TAG"
|
|
|
|
echo "Built image wubloader-$component:$TAG"
|
|
|
|
if [ -n "$PUSH" ]; then
|
|
|
|
if [ -n "$PUSH" ]; then
|
|
|
|