Browse code

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

Tianon Gravi authored on 2013/10/01 04:57:30
Showing 3 changed files
... ...
@@ -16,43 +16,53 @@
16 16
 #
17 17
 # # Publish a release:
18 18
 # docker run -privileged -lxc-conf=lxc.aa_profile=unconfined \
19
-# -e AWS_S3_BUCKET=baz \
20
-# -e AWS_ACCESS_KEY=foo \
21
-# -e AWS_SECRET_KEY=bar \
22
-# -e GPG_PASSPHRASE=gloubiboulga \
23
-# -lxc-conf=lxc.aa_profile=unconfined -privileged docker hack/release.sh
24
-# 
19
+#  -e AWS_S3_BUCKET=baz \
20
+#  -e AWS_ACCESS_KEY=foo \
21
+#  -e AWS_SECRET_KEY=bar \
22
+#  -e GPG_PASSPHRASE=gloubiboulga \
23
+#  docker hack/release.sh
24
+#
25 25
 
26 26
 docker-version 0.6.1
27 27
 from	ubuntu:12.04
28 28
 maintainer	Solomon Hykes <solomon@dotcloud.com>
29
+
29 30
 # Build dependencies
30 31
 run	echo 'deb http://archive.ubuntu.com/ubuntu precise main universe' > /etc/apt/sources.list
31 32
 run	apt-get update
32 33
 run	apt-get install -y -q curl
33 34
 run	apt-get install -y -q git
34 35
 run	apt-get install -y -q mercurial
35
-# Install Go
36
-run	curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | tar -v -C /usr/local -xz
37
-env	PATH	/usr/local/go/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
38
-env	GOPATH	/go:/go/src/github.com/dotcloud/docker/vendor
36
+run	apt-get install -y -q build-essential
37
+
38
+# Install Go from source (for eventual cross-compiling)
39 39
 env	CGO_ENABLED 0
40
-run	cd /tmp && echo 'package main' > t.go && go test -a -i -v
40
+run	curl -s https://go.googlecode.com/files/go1.1.2.src.tar.gz | tar -v -C / -xz && mv /go /goroot
41
+run	cd /goroot/src && ./make.bash
42
+env GOROOT	/goroot
43
+env	PATH	$PATH:/goroot/bin
44
+env	GOPATH	/go:/go/src/github.com/dotcloud/docker/vendor
45
+
41 46
 # Ubuntu stuff
42 47
 run	apt-get install -y -q ruby1.9.3 rubygems libffi-dev
43
-run	gem install fpm
48
+run	gem install --no-rdoc --no-ri fpm
44 49
 run	apt-get install -y -q reprepro dpkg-sig
50
+
45 51
 # Install s3cmd 1.0.1 (earlier versions don't support env variables in the config)
46 52
 run	apt-get install -y -q python-pip
47 53
 run	pip install s3cmd
48 54
 run	pip install python-magic
49 55
 run	/bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY\n' > /.s3cfg
56
+
50 57
 # Runtime dependencies
51 58
 run	apt-get install -y -q iptables
52 59
 run	apt-get install -y -q lxc
60
+
53 61
 volume	/var/lib/docker
54 62
 workdir	/go/src/github.com/dotcloud/docker
63
+
55 64
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
56 65
 entrypoint ["hack/dind"]
66
+
57 67
 # Upload docker source
58 68
 add	.       /go/src/github.com/dotcloud/docker
... ...
@@ -25,9 +25,9 @@ set -e
25 25
 # but really, they shouldn't. We want to be in a container!
26 26
 RESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
27 27
 grep -q "$RESOLVCONF" /proc/mounts || {
28
-	echo "# WARNING! I don't seem to be running in a docker container."
29
-	echo "# The result of this command might be an incorrect build, and will not be officially supported."
30
-	echo "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'"
28
+	echo >&2 "# WARNING! I don't seem to be running in a docker container."
29
+	echo >&2 "# The result of this command might be an incorrect build, and will not be officially supported."
30
+	echo >&2 "# Try this: 'docker build -t docker . && docker run docker ./hack/make.sh'"
31 31
 }
32 32
 
33 33
 # List of bundles to create when no argument is passed
... ...
@@ -2,6 +2,6 @@
2 2
 
3 3
 DEST=$1
4 4
 
5
-go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" ./docker
6
-
7
-echo "Created binary: $DEST/docker-$VERSION"
5
+if go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" ./docker; then
6
+	echo "Created binary: $DEST/docker-$VERSION"
7
+fi