Dockerfile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 ubuntu:14.04
  26. MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
  27. # Packaged dependencies
  28. RUN apt-get update && apt-get install -y \
  29. apparmor \
  30. aufs-tools \
  31. automake \
  32. btrfs-tools \
  33. build-essential \
  34. curl \
  35. dpkg-sig \
  36. git \
  37. iptables \
  38. libapparmor-dev \
  39. libcap-dev \
  40. libsqlite3-dev \
  41. mercurial \
  42. parallel \
  43. python-mock \
  44. python-pip \
  45. python-websocket \
  46. reprepro \
  47. ruby1.9.1 \
  48. ruby1.9.1-dev \
  49. s3cmd=1.1.0* \
  50. --no-install-recommends
  51. # Get lvm2 source for compiling statically
  52. RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
  53. # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
  54. # Compile and install lvm2
  55. RUN cd /usr/local/lvm2 \
  56. && ./configure --enable-static_link \
  57. && make device-mapper \
  58. && make install_device-mapper
  59. # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
  60. # Install lxc
  61. ENV LXC_VERSION 1.0.7
  62. RUN mkdir -p /usr/src/lxc \
  63. && curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
  64. RUN cd /usr/src/lxc \
  65. && ./configure \
  66. && make \
  67. && make install \
  68. && ldconfig
  69. # Install Go
  70. ENV GO_VERSION 1.4
  71. RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/local -xz \
  72. && mkdir -p /go/bin
  73. ENV PATH /go/bin:/usr/local/go/bin:$PATH
  74. ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
  75. RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
  76. # Compile Go for cross compilation
  77. ENV DOCKER_CROSSPLATFORMS \
  78. linux/386 linux/arm \
  79. darwin/amd64 darwin/386 \
  80. freebsd/amd64 freebsd/386 freebsd/arm \
  81. windows/amd64 windows/386
  82. # (set an explicit GOARM of 5 for maximum compatibility)
  83. ENV GOARM 5
  84. RUN cd /usr/local/go/src \
  85. && set -x \
  86. && for platform in $DOCKER_CROSSPLATFORMS; do \
  87. GOOS=${platform%/*} \
  88. GOARCH=${platform##*/} \
  89. ./make.bash --no-clean 2>&1; \
  90. done
  91. # Reinstall standard library with netgo
  92. RUN go clean -i net && go install -tags netgo std
  93. # We still support compiling with older Go, so need to grab older "gofmt"
  94. ENV GOFMT_VERSION 1.3.3
  95. 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
  96. # Grab Go's cover tool for dead-simple code coverage testing
  97. RUN go get golang.org/x/tools/cmd/cover
  98. # TODO replace FPM with some very minimal debhelper stuff
  99. RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
  100. # Get the "busybox" image source so we can build locally instead of pulling
  101. RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
  102. # Get the "cirros" image source so we can import it instead of fetching it during tests
  103. RUN curl -sSL -o /cirros.tar.gz https://github.com/ewindisch/docker-cirros/raw/1cded459668e8b9dbf4ef976c94c05add9bbd8e9/cirros-0.3.0-x86_64-lxc.tar.gz
  104. # Get the "docker-py" source so we can run their integration tests
  105. ENV DOCKER_PY_COMMIT aa19d7b6609c6676e8258f6b900dea2eda1dbe95
  106. RUN git clone https://github.com/docker/docker-py.git /docker-py \
  107. && cd /docker-py \
  108. && git checkout -q $DOCKER_PY_COMMIT
  109. # Setup s3cmd config
  110. RUN { \
  111. echo '[default]'; \
  112. echo 'access_key=$AWS_ACCESS_KEY'; \
  113. echo 'secret_key=$AWS_SECRET_KEY'; \
  114. } > ~/.s3cfg
  115. # Set user.email so crosbymichael's in-container merge commits go smoothly
  116. RUN git config --global user.email 'docker-dummy@example.com'
  117. # Add an unprivileged user to be used for tests which need it
  118. RUN groupadd -r docker
  119. RUN useradd --create-home --gid docker unprivilegeduser
  120. VOLUME /var/lib/docker
  121. WORKDIR /go/src/github.com/docker/docker
  122. ENV DOCKER_BUILDTAGS apparmor selinux btrfs_noversion
  123. # Install man page generator
  124. COPY vendor /go/src/github.com/docker/docker/vendor
  125. # (copy vendor/ because go-md2man needs golang.org/x/net)
  126. RUN set -x \
  127. && git clone -b v1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
  128. && git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
  129. && go install -v github.com/cpuguy83/go-md2man
  130. # Wrap all commands in the "docker-in-docker" script to allow nested containers
  131. ENTRYPOINT ["hack/dind"]
  132. # Upload docker source
  133. COPY . /go/src/github.com/docker/docker