examples/guestbook-go: build from source and remove bin/docker dep

This commit is contained in:
Johan Euphrosine 2014-09-25 16:34:20 -07:00
parent a981ae5480
commit 964be36991
2 changed files with 7 additions and 18 deletions

View File

@ -1,9 +1,9 @@
FROM google/golang:latest
RUN mkdir -p /gopath/src/github.com/GoogleCloudPlatform/ && cd /gopath/src/github.com/GoogleCloudPlatform/ && \
git clone http://github.com/GoogleCloudPlatform/kubernetes && \
cd /gopath/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/_src/ && \
go get && go build -o ../bin/guestbook && \
cp ./guestbook/Dockerfile /gopath/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/
ADD . /gopath/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/_src
CMD docker build --rm --force-rm -t kubernetes/guestbook /gopath/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/
WORKDIR /gopath/src/github.com/GoogleCloudPlatform/kubernetes/examples/guestbook-go/
RUN cd _src/ && go get && go build -o ../bin/guestbook
RUN cp _src/guestbook/Dockerfile .
CMD tar cvzf - .

View File

@ -20,16 +20,5 @@ set -o errexit
set -o nounset
set -o pipefail
if [[ "${DOCKER_BIN+set}" == "set" ]]; then
echo "Using DOCKER_BIN=\"${DOCKER_BIN}\" from the environment."
elif DOCKER_BIN=$(which docker); then
echo "Setting DOCKER_BIN=\"${DOCKER_BIN}\" from host machine."
else
echo "Could not find a working docker binary and none passed in DOCKER_BIN." >&2
exit 1
fi
docker build --rm --force-rm -t kubernetes/guestbook-build .
docker run --rm -v "${DOCKER_BIN}:/usr/local/bin/docker" \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-ti --name guestbook-build kubernetes/guestbook-build
docker run --rm kubernetes/guestbook-build | docker build -t kubernetes/guestbook -