forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-docker
More file actions
executable file
·47 lines (37 loc) · 1.06 KB
/
build-docker
File metadata and controls
executable file
·47 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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"
if [ -z "${BINARYDIR}" ]; then
RELEASE="etcd-${1}"-$(go env GOOS)-$(go env GOARCH)
BINARYDIR="${RELEASE}"
TARFILE="${RELEASE}.tar.gz"
TARURL="https://github.com/etcd-io/etcd/releases/download/${1}/${TARFILE}"
if ! curl -f -L -o "${TARFILE}" "${TARURL}" ; then
echo "Failed to download ${TARURL}."
exit 1
fi
tar -zvxf "${TARFILE}"
fi
if [ "${ARCH}" != "amd64" ]; then
DOCKERFILE+=".${ARCH}"
VERSION+="-${ARCH}"
fi
BINARYDIR=${BINARYDIR:-.}
BUILDDIR=${BUILDDIR:-.}
IMAGEDIR=${BUILDDIR}/image-docker
mkdir -p "${IMAGEDIR}"/var/etcd
mkdir -p "${IMAGEDIR}"/var/lib/etcd
cp "${BINARYDIR}"/etcd "${BINARYDIR}"/etcdctl "${IMAGEDIR}"
cat ./"${DOCKERFILE}" > "${IMAGEDIR}"/Dockerfile
if [ -z "$TAG" ]; then
docker build -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
docker build -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
else
docker build -t "${TAG}:${VERSION}" "${IMAGEDIR}"
fi