test tagging
This commit is contained in:
parent
dc5833730c
commit
cd10376a3e
@ -146,11 +146,35 @@ build(){
|
|||||||
if [ -z "$context" ]; then
|
if [ -z "$context" ]; then
|
||||||
context="."
|
context="."
|
||||||
fi
|
fi
|
||||||
$engine buildx build --platform $platform -t $new_image_tag -f $context/$dockerfile $context
|
$engine buildx build --platform $platform -t $new_image_tag -f $context/$dockerfile $context --load
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
#push(){
|
push(){
|
||||||
#}
|
services=$(yq e '.services | keys | .[]' "$file")
|
||||||
|
for service in $services; do
|
||||||
|
|
||||||
|
platform=$(yq e ".services.$service.platform" "$file")
|
||||||
|
image=$(yq e ".services.$service.image" "$file")
|
||||||
|
build=$(yq e ".services.$service.build" "$file")
|
||||||
|
context=$(yq e ".services.$service.build.context" "$file")
|
||||||
|
dockerfile=$(yq e ".services.$service.build.dockerfile" "$file")
|
||||||
|
# Replace '/' and ':' with '-' in the platform string to make it suitable for a tag
|
||||||
|
platform_tag=$(echo "$platform" | tr '/:' '-')
|
||||||
|
# Append platform information to the image tag
|
||||||
|
new_image_tag="${image}-${platform_tag}"
|
||||||
|
|
||||||
|
# If dockerfile is null or empty, set it to "Dockerfile"
|
||||||
|
if [ -z "$dockerfile" ]; then
|
||||||
|
dockerfile="Dockerfile"
|
||||||
|
fi
|
||||||
|
if [ -z "$context" ]; then
|
||||||
|
context="."
|
||||||
|
fi
|
||||||
|
$engine push $new_image_tag
|
||||||
|
done
|
||||||
|
|
||||||
|
$engine manifest create $image
|
||||||
|
}
|
||||||
|
|
||||||
pull(){
|
pull(){
|
||||||
services=$(yq e '.services | keys | .[]' "$file")
|
services=$(yq e '.services | keys | .[]' "$file")
|
||||||
|
16
testtag.sh
Executable file
16
testtag.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image="nginx:latest"
|
||||||
|
platforms=("amd64" "arm64")
|
||||||
|
engine="docker"
|
||||||
|
|
||||||
|
# Start the command string
|
||||||
|
cmd="$engine manifest create $image"
|
||||||
|
|
||||||
|
# Append each platform-specific image to the command string
|
||||||
|
for platform in "${platforms[@]}"; do
|
||||||
|
cmd+=" $image-$platform"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Output the complete command string
|
||||||
|
echo "$cmd"
|
Loading…
x
Reference in New Issue
Block a user