You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2019/10/11 16:56:25 UTC
[couchdb-docker] 01/01: Add scripts to simplify creation of
multiarch images
This is an automated email from the ASF dual-hosted git repository.
wohali pushed a commit to branch multiarch
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git
commit 8157eb7b8d4f9d98225352b4668bb7f5a529d441
Author: Joan Touzet <wo...@apache.org>
AuthorDate: Fri Oct 11 09:56:04 2019 -0700
Add scripts to simplify creation of multiarch images
---
build-manifest.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
build.sh | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+)
diff --git a/build-manifest.sh b/build-manifest.sh
new file mode 100755
index 0000000..84f1e7f
--- /dev/null
+++ b/build-manifest.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# This shell script builds all the supported architectures for
+# a single version, pushes them to Docker Hub, then creates the
+# manifest.
+
+# Usage: ./build-manifest.sh <VERSION>
+
+# With help from https://lobradov.github.io/Building-docker-multiarch-images/
+
+set -e
+
+for arch in amd64 arm64v8 ppc64le; do
+ ./build.sh $1 ${arch}
+ docker push apache/couchdb:${arch}-$1
+done
+
+docker manifest create apache/couchdb:$1 \
+ apache/couchdb:amd64-$1 \
+ apache/couchdb:arm64v8-$1 \
+ apache/couchdb:ppc64le-$1
+
+docker manifest annotate apache/couchdb:$1 \
+ apache/couchdb:arm64v8-$1 --os linux --arch arm64 --variant armv8
+
+docker manifest annotate apache/couchdb:$1 \
+ apache/couchdb:ppc64le-$1 --os linux --arch ppc64le
+
+docker manifest push apache/couchdb:$1
+
+docker manifest inspect apache/couchdb:$1
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..5e90e28
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# This shell script makes it easier to build multi-platform
+# architecture Docker containers on an x86_64 host.
+
+# Usage: ./build.sh <VERSION> <ARCH>
+
+# Inspired by https://github.com/jessfraz/irssi/blob/master/.travis.yml
+
+set -e
+
+TARGET=$1
+ARCH=${2:-amd64}
+
+if [ -n "${ARCH:-}" ]; then
+ from="$(awk '$1 == toupper("FROM") { print $2 }' $TARGET/Dockerfile)"
+ docker pull "$ARCH/$from"
+ docker tag "$ARCH/$from" "$from"
+fi
+
+docker build -t apache/couchdb:$ARCH-$TARGET $TARGET