scripts/build-docker: build docker in image-docker dir

The docker build command will use whatever directory contains the
Dockerfile as the build context (including all of its subdirectories).
And the <src> path of ADD must be inside the context of the build.
So change it to build in a specific directory for clean and fast.
This commit is contained in:
Yicheng Qin 2015-09-06 00:07:00 -07:00
parent 15d1db9bf8
commit 184337568d

View File

@ -1,6 +1,14 @@
#!/usr/bin/env bash
cat <<DF > Dockerfile
BINARYDIR=${BINARYDIR:-.}
BUILDDIR=${BUILDDIR:-.}
IMAGEDIR=${BUILDDIR}/image-docker
mkdir -p ${IMAGEDIR}
cp ${BINARYDIR}/etcd ${BINARYDIR}/etcdctl ${IMAGEDIR}
cat <<DF > ${IMAGEDIR}/Dockerfile
FROM scratch
ADD etcd /
ADD etcdctl /
@ -8,4 +16,4 @@ EXPOSE 4001 7001 2379 2380
ENTRYPOINT ["/etcd"]
DF
docker build -t quay.io/coreos/etcd:${1} .
docker build -t quay.io/coreos/etcd:${1} ${IMAGEDIR}