Browse code

Adjust Dockerfile style to be more consistent

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>

Tianon Gravi authored on 2014/12/24 16:12:27
Showing 1 changed files
... ...
@@ -23,11 +23,11 @@
23 23
 # the case. Therefore, you don't have to disable it anymore.
24 24
 #
25 25
 
26
-FROM	ubuntu:14.04
27
-MAINTAINER	Tianon Gravi <admwiggin@gmail.com> (@tianon)
26
+FROM ubuntu:14.04
27
+MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
28 28
 
29 29
 # Packaged dependencies
30
-RUN	apt-get update && apt-get install -y \
30
+RUN apt-get update && apt-get install -y \
31 31
 	aufs-tools \
32 32
 	automake \
33 33
 	btrfs-tools \
... ...
@@ -52,72 +52,86 @@ RUN	apt-get update && apt-get install -y \
52 52
 	--no-install-recommends
53 53
 
54 54
 # Get lvm2 source for compiling statically
55
-RUN	git clone --no-checkout https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103
55
+RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
56 56
 # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
57
-# note: we don't use "git clone -b" above because it then spews big nasty warnings about 'detached HEAD' state that we can't silence as easily as we can silence them using "git checkout" directly
58 57
 
59 58
 # Compile and install lvm2
60
-RUN	cd /usr/local/lvm2 && ./configure --enable-static_link && make device-mapper && make install_device-mapper
59
+RUN cd /usr/local/lvm2 \
60
+	&& ./configure --enable-static_link \
61
+	&& make device-mapper \
62
+	&& make install_device-mapper
61 63
 # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
62 64
 
63 65
 # Install Go
64
-RUN	curl -sSL https://golang.org/dl/go1.4.src.tar.gz | tar -v -C /usr/local -xz
65
-ENV	PATH	/usr/local/go/bin:$PATH
66
-ENV	GOPATH	/go:/go/src/github.com/docker/docker/vendor
66
+RUN curl -sSL https://golang.org/dl/go1.4.src.tar.gz | tar -v -C /usr/local -xz
67
+ENV PATH /usr/local/go/bin:$PATH
68
+ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
67 69
 ENV PATH /go/bin:$PATH
68
-RUN	cd /usr/local/go/src && ./make.bash --no-clean 2>&1
70
+RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
69 71
 
70 72
 # Compile Go for cross compilation
71
-ENV	DOCKER_CROSSPLATFORMS	\
73
+ENV DOCKER_CROSSPLATFORMS \
72 74
 	linux/386 linux/arm \
73 75
 	darwin/amd64 darwin/386 \
74 76
 	freebsd/amd64 freebsd/386 freebsd/arm \
75 77
 	windows/amd64 windows/386
76 78
 
77 79
 # (set an explicit GOARM of 5 for maximum compatibility)
78
-ENV	GOARM	5
79
-RUN	cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'
80
+ENV GOARM 5
81
+RUN cd /usr/local/go/src \
82
+	&& set -x \
83
+	&& for platform in $DOCKER_CROSSPLATFORMS; do \
84
+		GOOS=${platform%/*} \
85
+		GOARCH=${platform##*/} \
86
+			./make.bash --no-clean 2>&1; \
87
+	done
80 88
 
81 89
 # reinstall standard library with netgo
82 90
 RUN go clean -i net && go install -tags netgo std
83 91
 
84 92
 # Grab Go's cover tool for dead-simple code coverage testing
85
-RUN	go get golang.org/x/tools/cmd/cover
93
+RUN go get golang.org/x/tools/cmd/cover
86 94
 
87 95
 # TODO replace FPM with some very minimal debhelper stuff
88
-RUN	gem install --no-rdoc --no-ri fpm --version 1.3.2
89
-
90
-# Install man page generator
91
-RUN mkdir -p /go/src/github.com/cpuguy83 \
92
-    && git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
93
-    && cd /go/src/github.com/cpuguy83/go-md2man \
94
-    && go get -v ./...
96
+RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
95 97
 
96 98
 # Get the "busybox" image source so we can build locally instead of pulling
97
-RUN	git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
99
+RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
98 100
 
99 101
 # Get the "cirros" image source so we can import it instead of fetching it during tests
100
-RUN	curl -sSL -o /cirros.tar.gz https://github.com/ewindisch/docker-cirros/raw/1cded459668e8b9dbf4ef976c94c05add9bbd8e9/cirros-0.3.0-x86_64-lxc.tar.gz
102
+RUN curl -sSL -o /cirros.tar.gz https://github.com/ewindisch/docker-cirros/raw/1cded459668e8b9dbf4ef976c94c05add9bbd8e9/cirros-0.3.0-x86_64-lxc.tar.gz
101 103
 
102 104
 # Get the "docker-py" source so we can run their integration tests
103
-RUN	git clone -b 0.7.0 https://github.com/docker/docker-py.git /docker-py
105
+RUN git clone -b 0.7.0 https://github.com/docker/docker-py.git /docker-py
104 106
 
105 107
 # Setup s3cmd config
106
-RUN	/bin/echo -e '[default]\naccess_key=$AWS_ACCESS_KEY\nsecret_key=$AWS_SECRET_KEY' > $HOME/.s3cfg
108
+RUN { \
109
+		echo '[default]'; \
110
+		echo 'access_key=$AWS_ACCESS_KEY'; \
111
+		echo 'secret_key=$AWS_SECRET_KEY'; \
112
+	} > ~/.s3cfg
107 113
 
108 114
 # Set user.email so crosbymichael's in-container merge commits go smoothly
109
-RUN	git config --global user.email 'docker-dummy@example.com'
115
+RUN git config --global user.email 'docker-dummy@example.com'
110 116
 
111 117
 # Add an unprivileged user to be used for tests which need it
112 118
 RUN groupadd -r docker
113 119
 RUN useradd --create-home --gid docker unprivilegeduser
114 120
 
115
-VOLUME	/var/lib/docker
116
-WORKDIR	/go/src/github.com/docker/docker
117
-ENV	DOCKER_BUILDTAGS	apparmor selinux btrfs_noversion
121
+VOLUME /var/lib/docker
122
+WORKDIR /go/src/github.com/docker/docker
123
+ENV DOCKER_BUILDTAGS apparmor selinux btrfs_noversion
124
+
125
+# Install man page generator
126
+COPY vendor /go/src/github.com/docker/docker/vendor
127
+# (copy vendor/ because go-md2man needs golang.org/x/net)
128
+RUN set -x \
129
+	&& git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
130
+	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
131
+	&& go install -v github.com/cpuguy83/go-md2man
118 132
 
119 133
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
120
-ENTRYPOINT	["hack/dind"]
134
+ENTRYPOINT ["hack/dind"]
121 135
 
122 136
 # Upload docker source
123
-COPY	.	/go/src/github.com/docker/docker
137
+COPY . /go/src/github.com/docker/docker