PageRenderTime 26ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/Dockerfile

https://gitlab.com/apachipa/docker-1
Dockerfile | 263 lines | 172 code | 28 blank | 63 comment | 75 complexity | 452b38e2772f86d63ea2d38450e37865 MD5 | raw file
  1. # This file describes the standard way to build Docker, using docker
  2. #
  3. # Usage:
  4. #
  5. # # Assemble the full dev environment. This is slow the first time.
  6. # docker build -t docker .
  7. #
  8. # # Mount your source in an interactive container for quick testing:
  9. # docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash
  10. #
  11. # # Run the test suite:
  12. # docker run --privileged docker hack/make.sh test
  13. #
  14. # # Publish a release:
  15. # docker run --privileged \
  16. # -e AWS_S3_BUCKET=baz \
  17. # -e AWS_ACCESS_KEY=foo \
  18. # -e AWS_SECRET_KEY=bar \
  19. # -e GPG_PASSPHRASE=gloubiboulga \
  20. # docker hack/release.sh
  21. #
  22. # Note: AppArmor used to mess with privileged mode, but this is no longer
  23. # the case. Therefore, you don't have to disable it anymore.
  24. #
  25. FROM debian:jessie
  26. # add zfs ppa
  27. RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 \
  28. || apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
  29. RUN echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
  30. # allow replacing httpredir mirror
  31. ARG APT_MIRROR=httpredir.debian.org
  32. RUN sed -i s/httpredir.debian.org/$APT_MIRROR/g /etc/apt/sources.list
  33. # Packaged dependencies
  34. RUN apt-get update && apt-get install -y \
  35. apparmor \
  36. apt-utils \
  37. aufs-tools \
  38. automake \
  39. bash-completion \
  40. binutils-mingw-w64 \
  41. bsdmainutils \
  42. btrfs-tools \
  43. build-essential \
  44. clang \
  45. createrepo \
  46. curl \
  47. dpkg-sig \
  48. gcc-mingw-w64 \
  49. git \
  50. iptables \
  51. jq \
  52. libapparmor-dev \
  53. libcap-dev \
  54. libltdl-dev \
  55. libsqlite3-dev \
  56. libsystemd-journal-dev \
  57. libtool \
  58. mercurial \
  59. net-tools \
  60. pkg-config \
  61. python-dev \
  62. python-mock \
  63. python-pip \
  64. python-websocket \
  65. ubuntu-zfs \
  66. xfsprogs \
  67. libzfs-dev \
  68. tar \
  69. zip \
  70. --no-install-recommends \
  71. && pip install awscli==1.10.15
  72. # Get lvm2 source for compiling statically
  73. ENV LVM2_VERSION 2.02.103
  74. RUN mkdir -p /usr/local/lvm2 \
  75. && curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
  76. | tar -xzC /usr/local/lvm2 --strip-components=1
  77. # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
  78. # Compile and install lvm2
  79. RUN cd /usr/local/lvm2 \
  80. && ./configure \
  81. --build="$(gcc -print-multiarch)" \
  82. --enable-static_link \
  83. && make device-mapper \
  84. && make install_device-mapper
  85. # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
  86. # Configure the container for OSX cross compilation
  87. ENV OSX_SDK MacOSX10.11.sdk
  88. ENV OSX_CROSS_COMMIT 8aa9b71a394905e6c5f4b59e2b97b87a004658a4
  89. RUN set -x \
  90. && export OSXCROSS_PATH="/osxcross" \
  91. && git clone https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \
  92. && ( cd $OSXCROSS_PATH && git checkout -q $OSX_CROSS_COMMIT) \
  93. && curl -sSL https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \
  94. && UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh
  95. ENV PATH /osxcross/target/bin:$PATH
  96. # install seccomp: the version shipped in trusty is too old
  97. ENV SECCOMP_VERSION 2.3.1
  98. RUN set -x \
  99. && export SECCOMP_PATH="$(mktemp -d)" \
  100. && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
  101. | tar -xzC "$SECCOMP_PATH" --strip-components=1 \
  102. && ( \
  103. cd "$SECCOMP_PATH" \
  104. && ./configure --prefix=/usr/local \
  105. && make \
  106. && make install \
  107. && ldconfig \
  108. ) \
  109. && rm -rf "$SECCOMP_PATH"
  110. # Install Go
  111. # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
  112. # will need updating, to avoid errors. Ping #docker-maintainers on IRC
  113. # with a heads-up.
  114. ENV GO_VERSION 1.6.2
  115. RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \
  116. | tar -xzC /usr/local
  117. ENV PATH /go/bin:/usr/local/go/bin:$PATH
  118. ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
  119. # Compile Go for cross compilation
  120. ENV DOCKER_CROSSPLATFORMS \
  121. linux/386 linux/arm \
  122. darwin/amd64 \
  123. freebsd/amd64 freebsd/386 freebsd/arm \
  124. windows/amd64 windows/386
  125. # This has been commented out and kept as reference because we don't support compiling with older Go anymore.
  126. # ENV GOFMT_VERSION 1.3.3
  127. # RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt
  128. ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
  129. # Grab Go's cover tool for dead-simple code coverage testing
  130. # Grab Go's vet tool for examining go code to find suspicious constructs
  131. # and help prevent errors that the compiler might not catch
  132. RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
  133. && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
  134. && go install -v golang.org/x/tools/cmd/cover \
  135. && go install -v golang.org/x/tools/cmd/vet
  136. # Grab Go's lint tool
  137. ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
  138. RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
  139. && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
  140. && go install -v github.com/golang/lint/golint
  141. # Install two versions of the registry. The first is an older version that
  142. # only supports schema1 manifests. The second is a newer version that supports
  143. # both. This allows integration-cli tests to cover push/pull with both schema1
  144. # and schema2 manifests.
  145. ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
  146. ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
  147. RUN set -x \
  148. && export GOPATH="$(mktemp -d)" \
  149. && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
  150. && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
  151. && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
  152. go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
  153. && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
  154. && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
  155. go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \
  156. && rm -rf "$GOPATH"
  157. # Install notary and notary-server
  158. ENV NOTARY_VERSION v0.3.0
  159. RUN set -x \
  160. && export GOPATH="$(mktemp -d)" \
  161. && git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
  162. && (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
  163. && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
  164. go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
  165. && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
  166. go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
  167. && rm -rf "$GOPATH"
  168. # Get the "docker-py" source so we can run their integration tests
  169. ENV DOCKER_PY_COMMIT 7befe694bd21e3c54bb1d7825270ea4bd6864c13
  170. RUN git clone https://github.com/docker/docker-py.git /docker-py \
  171. && cd /docker-py \
  172. && git checkout -q $DOCKER_PY_COMMIT \
  173. && pip install -r test-requirements.txt
  174. # Set user.email so crosbymichael's in-container merge commits go smoothly
  175. RUN git config --global user.email 'docker-dummy@example.com'
  176. # Add an unprivileged user to be used for tests which need it
  177. RUN groupadd -r docker
  178. RUN useradd --create-home --gid docker unprivilegeduser
  179. VOLUME /var/lib/docker
  180. WORKDIR /go/src/github.com/docker/docker
  181. ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
  182. # Let us use a .bashrc file
  183. RUN ln -sfv $PWD/.bashrc ~/.bashrc
  184. # Register Docker's bash completion.
  185. RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
  186. # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
  187. COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
  188. RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
  189. buildpack-deps:jessie@sha256:25785f89240fbcdd8a74bdaf30dd5599a9523882c6dfc567f2e9ef7cf6f79db6 \
  190. busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \
  191. debian:jessie@sha256:f968f10b4b523737e253a97eac59b0d1420b5c19b69928d35801a6373ffe330e \
  192. hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
  193. # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
  194. # Download man page generator
  195. RUN set -x \
  196. && export GOPATH="$(mktemp -d)" \
  197. && git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
  198. && git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
  199. && go get -v -d github.com/cpuguy83/go-md2man \
  200. && go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
  201. && rm -rf "$GOPATH"
  202. # Download toml validator
  203. ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
  204. RUN set -x \
  205. && export GOPATH="$(mktemp -d)" \
  206. && git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
  207. && (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
  208. && go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
  209. && rm -rf "$GOPATH"
  210. # Install runc
  211. ENV RUNC_COMMIT d49ece5a83da3dcb820121d6850e2b61bd0a5fbe
  212. RUN set -x \
  213. && export GOPATH="$(mktemp -d)" \
  214. && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
  215. && cd "$GOPATH/src/github.com/opencontainers/runc" \
  216. && git checkout -q "$RUNC_COMMIT" \
  217. && make static BUILDTAGS="seccomp apparmor selinux" \
  218. && cp runc /usr/local/bin/docker-runc \
  219. && rm -rf "$GOPATH"
  220. # Install containerd
  221. ENV CONTAINERD_COMMIT cf554d59dd96e459544748290eb9167f4bcde509
  222. RUN set -x \
  223. && export GOPATH="$(mktemp -d)" \
  224. && git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
  225. && cd "$GOPATH/src/github.com/docker/containerd" \
  226. && git checkout -q "$CONTAINERD_COMMIT" \
  227. && make static \
  228. && cp bin/containerd /usr/local/bin/docker-containerd \
  229. && cp bin/containerd-shim /usr/local/bin/docker-containerd-shim \
  230. && cp bin/ctr /usr/local/bin/docker-containerd-ctr \
  231. && rm -rf "$GOPATH"
  232. # Wrap all commands in the "docker-in-docker" script to allow nested containers
  233. ENTRYPOINT ["hack/dind"]
  234. # Upload docker source
  235. COPY . /go/src/github.com/docker/docker