Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-architecture in docker images #23

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/drill/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: drill
version: 0.6.1
version: 0.7.0
appVersion: 1.21.1-3.9.1
description: Helm charts for deploying Apache Drill on a Kubernetes cluster
type: application
Expand Down
4 changes: 2 additions & 2 deletions charts/drill/charts/zookeeper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: zookeeper
version: 0.5.1
version: 0.7.0
appVersion: 3.9.1
description: Helm chart for deploying Apache Zookeeper on a Kubernetes cluster
type: application
Expand All @@ -13,6 +13,6 @@ home: 'http://zookeeper.apache.org/'
sources:
- 'https://github.com/unicef/magasin-drill'
maintainers:
- name: Merlos
- name: merlos
email: merlos@users.noreply.github.com

4 changes: 2 additions & 2 deletions charts/drill/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ drill:
# Total CPU for each Drill pod
cpu: 4000m
# Drill image with tag
image: merlos/drill:1.21.1-deb
image: merlos/drill:1.21.1-multi-arch
# Drill's HTTP port
httpPort: 8047
# User Server port. The Bit Server Port and Data Server ports are +1 and +2
Expand Down Expand Up @@ -131,4 +131,4 @@ zookeeper:
# Total CPU for each ZooKeeper pod
cpu: 500m
# ZooKeeper image with tag
image: merlos/zookeeper:3.9.1-deb
image: merlos/zookeeper:3.9.1-multi-arch
21 changes: 11 additions & 10 deletions docker/drill/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ usage() {
echo " Example: 1.21.1"
echo " Available versions on https://archive.apache.org/dist/drill/"
echo " -t TAG: Optional tag for the image. If not provided, defaults to the VERSION."
echo " -p: Optional flag to push the built image to the registry."
echo " -p: Optional flag to push the built image to the registry and enable multi-arch."
echo
echo " Example:"
echo " $0 -r merlos -v 1.21.1"
Expand Down Expand Up @@ -76,7 +76,7 @@ if ! docker buildx inspect magasin-builder >/dev/null 2>&1; then
echo "Creating magasin-builder buildx instance..."

# Create magasin-builder buildx instance with docker-container driver
docker buildx create --driver=docker-container --name=magasin-builder
docker buildx create --driver=docker-container --name=magasin-builder

if [ $? -eq 0 ]; then
echo "magasin-builder buildx instance created successfully."
Expand All @@ -88,17 +88,18 @@ else
echo "magasin-builder buildx instance already exists."
fi

docker buildx build --builder=magasin-builder --platform linux/amd64 --build-arg VERSION=${VERSION} -t ${PROJECT}:${TAG} --load .


# If there was no error building the image
if [[ $? -eq 0 ]]; then
if [[ $PUSH == true ]]; then
echo "Pushing to registry ${REGISTRY}..."
docker tag ${PROJECT}:${TAG} ${REGISTRY}/${PROJECT}:${TAG}
docker push ${REGISTRY}/${PROJECT}:${TAG}
echo "Done"
else

if [[ $PUSH == true ]]; then
echo "Pushing to registry ${REGISTRY}..."
docker buildx build --builder=magasin-builder --platform linux/amd64,linux/arm64 --build-arg VERSION=${VERSION} -t ${REGISTRY}/${PROJECT}:${TAG} --push .
echo "Done"
else
docker buildx build --builder=magasin-builder --build-arg VERSION=${VERSION} -t ${REGISTRY}/${PROJECT}:${TAG} --load .
if [[ $? -eq 0 ]]; then
echo "Build successful. Image not pushed to registry as -p flag not provided."
fi
fi

25 changes: 14 additions & 11 deletions docker/zookeeper/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ usage() {
echo "Usage: $0 -r REGISTRY -v VERSION [-t TAG] [-p]"
echo " -r REGISTRY: The registry where the package will be published."
echo " Example: your username in dockerhub"
echo " -v VERSION: The version number of the zookeeper to be created."
echo " Example: 3.9.1"
echo " Available versions on https://downloads.apache.org/zookeeper"
echo " -t TAG: Optional tag for the image. If not provided, defaults to the VERSION."
echo " -p: Optional flag to push the built image to the registry."
echo " -v VERSION: The version number of the zookeeper to be created."
echo " Example: 3.9.1"
echo " Available versions on https://downloads.apache.org/zookeeper"
echo " -t TAG: Optional tag for the image. If not provided, defaults to the VERSION."
echo " -p: Optional flag to build multi-architecture (amd64,arm64) and push the"
echo " image to the registry"
echo
echo " Example:"
echo " $0 -r merlos -v 3.9.1"
Expand Down Expand Up @@ -88,17 +89,19 @@ else
echo "magasin-builder buildx instance already exists."
fi

docker buildx build --builder=magasin-builder --platform linux/amd64 --build-arg VERSION=${VERSION} -t ${PROJECT}:${TAG} --load .



# If there was no error building the image
if [[ $? -eq 0 ]]; then
if [[ $PUSH == true ]]; then

if [[ $PUSH == true ]]; then
echo "Pushing to registry ${REGISTRY}..."
docker tag ${PROJECT}:${TAG} ${REGISTRY}/${PROJECT}:${TAG}
docker push ${REGISTRY}/${PROJECT}:${TAG}
docker buildx build --builder=magasin-builder --platform linux/amd64,linux/arm64 --build-arg VERSION=${VERSION} -t ${REGISTRY}/${PROJECT}:${TAG} --push .
echo "Done"
else
echo "Build successful. Image not pushed to registry as -p flag not provided."
docker buildx build --builder=magasin-builder --build-arg VERSION=${VERSION} -t ${REGISTRY}/${PROJECT}:${TAG} --load .
if [[ $? -eq 0 ]]; then
echo "Build successful. Image not pushed to registry as -p flag not provided."
fi
fi
fi