Compare commits

..

3 Commits

Author SHA1 Message Date
cd10376a3e test tagging 2023-10-08 00:00:59 +05:00
dc5833730c empty context 2023-10-06 01:43:43 +05:00
82e2cc3167 empty Dockerfile 2023-10-06 01:36:20 +05:00
2 changed files with 52 additions and 4 deletions

View File

@@ -131,18 +131,50 @@ build(){
platform=$(yq e ".services.$service.platform" "$file") platform=$(yq e ".services.$service.platform" "$file")
image=$(yq e ".services.$service.image" "$file") image=$(yq e ".services.$service.image" "$file")
build=$(yq e ".services.$service.build" "$file")
context=$(yq e ".services.$service.build.context" "$file") context=$(yq e ".services.$service.build.context" "$file")
dockerfile=$(yq e ".services.$service.build.dockerfile" "$file") dockerfile=$(yq e ".services.$service.build.dockerfile" "$file")
# Replace '/' and ':' with '-' in the platform string to make it suitable for a tag # Replace '/' and ':' with '-' in the platform string to make it suitable for a tag
platform_tag=$(echo "$platform" | tr '/:' '-') platform_tag=$(echo "$platform" | tr '/:' '-')
# Append platform information to the image tag # Append platform information to the image tag
new_image_tag="${image}-${platform_tag}" new_image_tag="${image}-${platform_tag}"
$engine buildx build --platform $platform -t $new_image_tag -f $context/$dockerfile $context # If dockerfile is null or empty, set it to "Dockerfile"
if [ -z "$dockerfile" ]; then
dockerfile="Dockerfile"
fi
if [ -z "$context" ]; then
context="."
fi
$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
View 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"