mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
build-docker: Updates for multi-arch release
o Set -e to abort script if a command fails. o Allow custom docker 'TAG' from the environment. o Move arch suffix to version to allow all images to be put into a single repository. o Enable cross builds. When doing cross builds where the host and target architectures are different 'RUN mkdir' will fail since the target container cannot be run on the host. To work around this, create the directories in build-docker, then use ADD in the Dockerfile. o Add Dockerfile-release.arm64 Signed-off-by: Geoff Levand <geoff@infradead.org>
This commit is contained in:
parent
8309ca92d7
commit
0c8988aa07
11
Dockerfile-release.arm64
Normal file
11
Dockerfile-release.arm64
Normal file
@ -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"]
|
@ -2,8 +2,8 @@ FROM ppc64le/ubuntu:16.04
|
||||
|
||||
ADD etcd /usr/local/bin/
|
||||
ADD etcdctl /usr/local/bin/
|
||||
RUN mkdir -p /var/etcd/
|
||||
RUN mkdir -p /var/lib/etcd/
|
||||
ADD var/etcd /var/etcd
|
||||
ADD var/lib/etcd /var/lib/etcd
|
||||
|
||||
EXPOSE 2379 2380
|
||||
|
||||
|
@ -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,7 +27,7 @@ fi
|
||||
|
||||
if [ ${ARCH} != "amd64" ]; then
|
||||
DOCKERFILE+=".${ARCH}"
|
||||
TAG+="-${ARCH}"
|
||||
VERSION+="-${ARCH}"
|
||||
fi
|
||||
|
||||
BINARYDIR=${BINARYDIR:-.}
|
||||
@ -32,9 +35,10 @@ 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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user