Explorar o código

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.
Yicheng Qin %!s(int64=10) %!d(string=hai) anos
pai
achega
184337568d
Modificáronse 1 ficheiros con 10 adicións e 2 borrados
  1. 10 2
      scripts/build-docker

+ 10 - 2
scripts/build-docker

@@ -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}