Skip to content

Commit

Permalink
scripts/build-docker: build docker in image-docker dir
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yichengq committed Sep 6, 2015
1 parent 15d1db9 commit 1843375
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/build-docker
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/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 /
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}

0 comments on commit 1843375

Please sign in to comment.