-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
*: add multi-arch support in release binaries #7714
Changes from all commits
fb62872
8309ca9
0c8988a
07c07ce
bf98718
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM aarch64/ubuntu:16.04 | ||
|
||
ADD etcd /usr/local/bin/ | ||
ADD etcdctl /usr/local/bin/ | ||
ADD var/etcd /var/etcd | ||
ADD var/lib/etcd /var/lib/etcd | ||
|
||
EXPOSE 2379 2380 | ||
|
||
# Define default command. | ||
CMD ["/usr/local/bin/etcd"] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 VERSION" >&2 | ||
exit 1 | ||
fi | ||
|
||
VERSION=${1} | ||
ARCH=$(go env GOARCH) | ||
DOCKERFILE="Dockerfile-release" | ||
TAG="quay.io/coreos/etcd" | ||
: ${TAG:="quay.io/coreos/etcd"} | ||
|
||
if [ -z ${BINARYDIR} ]; then | ||
RELEASE="etcd-${1}"-`go env GOOS`-`go env GOARCH` | ||
|
@@ -24,17 +27,18 @@ fi | |
|
||
if [ ${ARCH} != "amd64" ]; then | ||
DOCKERFILE+=".${ARCH}" | ||
TAG+="-${ARCH}" | ||
VERSION+="-${ARCH}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the usual way to do multi arch? Won't this break ${TAG}:latest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was following the presence set by flannel: https://quay.io/repository/coreos/flannel?tab=tags There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
fi | ||
|
||
BINARYDIR=${BINARYDIR:-.} | ||
BUILDDIR=${BUILDDIR:-.} | ||
|
||
IMAGEDIR=${BUILDDIR}/image-docker | ||
|
||
mkdir -p ${IMAGEDIR} | ||
mkdir -p ${IMAGEDIR}/var/etcd | ||
mkdir -p ${IMAGEDIR}/var/lib/etcd | ||
cp ${BINARYDIR}/etcd ${BINARYDIR}/etcdctl ${IMAGEDIR} | ||
|
||
cat ./${DOCKERFILE} > ${IMAGEDIR}/Dockerfile | ||
|
||
docker build -t ${TAG}:${1} ${IMAGEDIR} | ||
docker build -t ${TAG}:${VERSION} ${IMAGEDIR} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
# | ||
set -e | ||
|
||
ARCH=$(go env GOARCH) | ||
VERSION=$1 | ||
if [ -z "${VERSION}" ]; then | ||
echo "Usage: ${0} VERSION" >> /dev/stderr | ||
|
@@ -27,8 +26,15 @@ ETCD_ROOT=$(dirname "${BASH_SOURCE}")/.. | |
pushd ${ETCD_ROOT} >/dev/null | ||
echo Building etcd binary... | ||
./scripts/build-binary ${VERSION} | ||
echo Building aci image... | ||
BINARYDIR=release/etcd-${VERSION}-linux-amd64 BUILDDIR=release ./scripts/build-aci ${VERSION} | ||
echo Building docker image... | ||
BINARYDIR=release/etcd-${VERSION}-linux-${ARCH} BUILDDIR=release ./scripts/build-docker ${VERSION} | ||
|
||
# ppc64le not yet supported by acbuild. | ||
for TARGET_ARCH in "amd64" "arm64"; do | ||
echo Building ${TARGET_ARCH} aci image... | ||
GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-aci ${VERSION} | ||
done | ||
|
||
for TARGET_ARCH in "amd64" "arm64" "ppc64le"; do | ||
echo Building ${TARGET_ARCH} docker image... | ||
GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-docker ${VERSION} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was under the impression it's not possible to build docker images on a mismatched architecture. Does this work because the Dockerfile doesn't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, if the Dockerfile just uses ADD it works. If we want to use RUN, then I think we could setup QEMU user emulation to do that, but that is significantly more complicated and would add to the requirements of the host. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, great! glad it's possible to avoid that whole qemu mess |
||
done | ||
popd >/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be tagged as
arm64
oraarch64
? is there an official convention yet?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is totally open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK