Compare commits
No commits in common. "main" and "main" have entirely different histories.
@ -1,20 +1,12 @@
|
||||
version: '3.5'
|
||||
services:
|
||||
debian10:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
x-bake:
|
||||
platforms:
|
||||
- linux/amd64/v1
|
||||
- linux/amd64/v2
|
||||
- linux/amd64/v3
|
||||
- linux/arm/v7
|
||||
- linux/arm64
|
||||
pull: true
|
||||
tags:
|
||||
- ghcr.io/shihaamabr/debian-curl/debian-curl:10
|
||||
- registry.gitlab.com/shihaam_me/debian-curl/debian-curl:10
|
||||
- git.shihaam.dev/dockerfiles/debian-curl/debian-curl:10
|
||||
hostname: debian10
|
||||
# image: git.shihaam.dev/dockerfiles/debian-curl:10
|
||||
debian10-x86:
|
||||
build: .
|
||||
hostname: debian10-x86
|
||||
platform: linux/amd64/v3
|
||||
image: git.shihaam.dev/dockerfiles/debian-curl:10
|
||||
debian10-arm:
|
||||
build: .
|
||||
hostname: debian10-arm
|
||||
platform: linux/arm64
|
||||
image: git.shihaam.dev/dockerfiles/debian-curl:10
|
||||
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
docker compose build
|
||||
|
||||
docker tag debian-curl:x86-10 git.shihaam.dev/dockerfiles/debian-curl:x86-10
|
||||
docker tag debian-curl:arm-10 git.shihaam.dev/dockerfiles/debian-curl:arm-10
|
||||
|
||||
|
||||
docker push git.shihaam.dev/dockerfiles/debian-curl:x86-10
|
||||
docker push git.shihaam.dev/dockerfiles/debian-curl:arm-10
|
||||
|
||||
docker manifest create git.shihaam.dev/dockerfiles/debian-curl:10 \
|
||||
git.shihaam.dev/dockerfiles/debian-curl:x86-10 \
|
||||
git.shihaam.dev/dockerfiles/debian-curl:arm-10
|
||||
|
||||
#docker manifest create git.shihaam.dev/dockerfiles/debian-curl/debian-curl:test \
|
||||
#git.shihaam.dev/dockerfiles/debian-curl/debian-curl:test-git.shihaam.dev/dockerfiles/debian-curl/debian-curl:test-linux-amd64-v3 \
|
||||
#git.shihaam.dev/dockerfiles/debian-curl/debian-curl:test-git.shihaam.dev/dockerfiles/debian-curl/debian-curl:test-linux-arm64
|
||||
|
||||
#docker manifest annotate git.shihaam.dev/dockerfiles/debian-curl:10 \
|
||||
#git.shihaam.dev/dockerfiles/debian-curl:x86-10 --os linux --arch amd64
|
||||
|
||||
#docker manifest annotate git.shihaam.dev/dockerfiles/debian-curl:10 \
|
||||
#git.shihaam.dev/dockerfiles/debian-curl:arm-10 --os linux --arch arm64
|
||||
|
||||
|
||||
docker manifest push git.shihaam.dev/dockerfiles/debian-curl:10
|
@ -1,98 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if podman is installed
|
||||
if command -v podman &> /dev/null
|
||||
then
|
||||
container_engine="podman"
|
||||
# Check if docker is installed
|
||||
elif command -v docker &> /dev/null
|
||||
then
|
||||
container_engine="docker"
|
||||
else
|
||||
# Neither podman nor docker is installed
|
||||
echo "Neither Podman nor Docker is installed."
|
||||
echo "Please install either Podman or Docker to proceed."
|
||||
exit 1
|
||||
fi
|
||||
echo "Using $container_engine as the container engine."
|
||||
#
|
||||
yq() {
|
||||
$container_engine run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@"
|
||||
}
|
||||
|
||||
# Default file
|
||||
FILE="docker-compose.yml"
|
||||
|
||||
# Check for -f argument
|
||||
while getopts "f:" opt; do
|
||||
case $opt in
|
||||
f)
|
||||
FILE="$OPTARG"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [-f docker-compose-file] build <service_name>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if file exists
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "File $FILE does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read and print service name, platform, and image
|
||||
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")
|
||||
echo "Service: $service"
|
||||
echo "Platform: $platform"
|
||||
echo "Image: $image"
|
||||
echo "---------------------"
|
||||
done
|
||||
|
||||
build_image() {
|
||||
local service=$1
|
||||
local platform=$(yq e ".services.$service.platform" "$FILE")
|
||||
local image=$(yq e ".services.$service.image" "$FILE")
|
||||
local context=$(yq e ".services.$service.build.context" "$FILE")
|
||||
local dockerfile=$(yq e ".services.$service.build.dockerfile" "$FILE")
|
||||
|
||||
# Check if platform is defined
|
||||
if [ -z "$platform" ]; then
|
||||
echo "Error: Platform is not defined for service $service."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Replace '/' and ':' with '-' in the platform string to make it suitable for a tag
|
||||
local platform_tag=$(echo "$platform" | tr '/:' '-')
|
||||
|
||||
# Append platform information to the image tag
|
||||
local new_image_tag="${image}-${platform_tag}"
|
||||
|
||||
echo "Building service: $service"
|
||||
echo "Platform: $platform"
|
||||
echo "Image: $new_image_tag"
|
||||
echo "---------------------"
|
||||
|
||||
$container_engine buildx build --platform "$platform" -t "$new_image_tag" -f "$context/$dockerfile" "$context"
|
||||
}
|
||||
# Check for "build" argument and optional service name
|
||||
if [ "$1" == "build" ]; then
|
||||
if [ "$#" -ge 2 ]; then
|
||||
# Build specified service
|
||||
build_image "$2"
|
||||
else
|
||||
# Build all services
|
||||
services=$(yq e '.services | keys | .[]' "$FILE")
|
||||
for service in $services; do
|
||||
build_image "$service"
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "Usage: $0 [-f docker-compose-file] build [service_name]"
|
||||
exit 1
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user