Browse Source

Add cleanup/refactor portion of #2010 for hack and Dockerfile updates

Tianon Gravi 11 years ago
parent
commit
ccefe47897
3 changed files with 28 additions and 18 deletions
  1. 22 12
      Dockerfile
  2. 3 3
      hack/make.sh
  3. 3 3
      hack/make/binary

+ 22 - 12
Dockerfile

@@ -16,43 +16,53 @@
 #
 # # Publish a release:
 # docker run -privileged -lxc-conf=lxc.aa_profile=unconfined \
-# -e AWS_S3_BUCKET=baz \
-# -e AWS_ACCESS_KEY=foo \
-# -e AWS_SECRET_KEY=bar \
-# -e GPG_PASSPHRASE=gloubiboulga \
-# -lxc-conf=lxc.aa_profile=unconfined -privileged docker hack/release.sh
-# 
+#  -e AWS_S3_BUCKET=baz \
+#  -e AWS_ACCESS_KEY=foo \
+#  -e AWS_SECRET_KEY=bar \
+#  -e GPG_PASSPHRASE=gloubiboulga \
+#  docker hack/release.sh
+#
 
 docker-version 0.6.1
 from	ubuntu:12.04
 maintainer	Solomon Hykes <solomon@dotcloud.com>
+
 # Build dependencies
 run	echo 'deb http://archive.ubuntu.com/ubuntu precise main universe' > /etc/apt/sources.list
 run	apt-get update
 run	apt-get install -y -q curl
 run	apt-get install -y -q git
 run	apt-get install -y -q mercurial
-# Install Go
-run	curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | tar -v -C /usr/local -xz
-env	PATH	/usr/local/go/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
-env	GOPATH	/go:/go/src/github.com/dotcloud/docker/vendor
+run	apt-get install -y -q build-essential
+
+# Install Go from source (for eventual cross-compiling)
 env	CGO_ENABLED 0
-run	cd /tmp && echo 'package main' > t.go && go test -a -i -v
+run	curl -s https://go.googlecode.com/files/go1.1.2.src.tar.gz | tar -v -C / -xz && mv /go /goroot
+run	cd /goroot/src && ./make.bash
+env GOROOT	/goroot
+env	PATH	$PATH:/goroot/bin
+env	GOPATH	/go:/go/src/github.com/dotcloud/docker/vendor
+
 # Ubuntu stuff
 run	apt-get install -y -q ruby1.9.3 rubygems libffi-dev
-run	gem install fpm
+run	gem install --no-rdoc --no-ri fpm
 run	apt-get install -y -q reprepro dpkg-sig
+
 # Install s3cmd 1.0.1 (earlier versions don't support env variables in the config)
 run	apt-get install -y -q python-pip
 run	pip install s3cmd
 run	pip install python-magic
 run	/bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY\n' > /.s3cfg
+
 # Runtime dependencies
 run	apt-get install -y -q iptables
 run	apt-get install -y -q lxc
+
 volume	/var/lib/docker
 workdir	/go/src/github.com/dotcloud/docker
+
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
 entrypoint ["hack/dind"]
+
 # Upload docker source
 add	.       /go/src/github.com/dotcloud/docker

+ 3 - 3
hack/make.sh

@@ -25,9 +25,9 @@ set -e
 # but really, they shouldn't. We want to be in a container!
 RESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
 grep -q "$RESOLVCONF" /proc/mounts || {
-	echo "# WARNING! I don't seem to be running in a docker container."
-	echo "# The result of this command might be an incorrect build, and will not be officially supported."
-	echo "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'"
+	echo >&2 "# WARNING! I don't seem to be running in a docker container."
+	echo >&2 "# The result of this command might be an incorrect build, and will not be officially supported."
+	echo >&2 "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'"
 }
 
 # List of bundles to create when no argument is passed

+ 3 - 3
hack/make/binary

@@ -2,6 +2,6 @@
 
 DEST=$1
 
-go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" ./docker
-
-echo "Created binary: $DEST/docker-$VERSION"
+if go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" ./docker; then
+	echo "Created binary: $DEST/docker-$VERSION"
+fi