github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/Dockerfile (about)

     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  
    26  FROM ubuntu:14.04
    27  MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
    28  
    29  # add zfs ppa
    30  RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
    31  RUN	echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
    32  
    33  # add llvm repo
    34  RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 15CF4D18AF4F7421
    35  RUN	echo deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main > /etc/apt/sources.list.d/llvm.list
    36  
    37  # Packaged dependencies
    38  RUN apt-get update && apt-get install -y \
    39  	apparmor \
    40  	aufs-tools \
    41  	automake \
    42  	bash-completion \
    43  	btrfs-tools \
    44  	build-essential \
    45  	clang-3.8 \
    46  	createrepo \
    47  	curl \
    48  	dpkg-sig \
    49  	gcc-mingw-w64 \
    50  	git \
    51  	iptables \
    52  	jq \
    53  	libapparmor-dev \
    54  	libcap-dev \
    55  	libltdl-dev \
    56  	libsqlite3-dev \
    57  	libsystemd-journal-dev \
    58  	libtool \
    59  	mercurial \
    60  	pkg-config \
    61  	python-dev \
    62  	python-mock \
    63  	python-pip \
    64  	python-websocket \
    65  	s3cmd=1.1.0* \
    66  	ubuntu-zfs \
    67  	xfsprogs \
    68  	libzfs-dev \
    69  	tar \
    70  	--no-install-recommends \
    71  	&& ln -snf /usr/bin/clang-3.8 /usr/local/bin/clang \
    72  	&& ln -snf /usr/bin/clang++-3.8 /usr/local/bin/clang++
    73  
    74  # Get lvm2 source for compiling statically
    75  RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
    76  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    77  
    78  # Compile and install lvm2
    79  RUN cd /usr/local/lvm2 \
    80  	&& ./configure --enable-static_link \
    81  	&& make device-mapper \
    82  	&& make install_device-mapper
    83  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    84  
    85  # Install Go
    86  ENV GO_VERSION 1.5.2
    87  RUN curl -sSL  "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -v -C /usr/local -xz
    88  ENV PATH /go/bin:/usr/local/go/bin:$PATH
    89  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
    90  
    91  # Compile Go for cross compilation
    92  ENV DOCKER_CROSSPLATFORMS \
    93  	linux/386 linux/arm \
    94  	darwin/amd64 darwin/386 \
    95  	freebsd/amd64 freebsd/386 freebsd/arm \
    96  	windows/amd64 windows/386
    97  
    98  # (set an explicit GOARM of 5 for maximum compatibility)
    99  ENV GOARM 5
   100  
   101  # This has been commented out and kept as reference because we don't support compiling with older Go anymore.
   102  # ENV GOFMT_VERSION 1.3.3
   103  # 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
   104  
   105  ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
   106  # Grab Go's cover tool for dead-simple code coverage testing
   107  # Grab Go's vet tool for examining go code to find suspicious constructs
   108  # and help prevent errors that the compiler might not catch
   109  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   110  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
   111  	&& go install -v golang.org/x/tools/cmd/cover \
   112  	&& go install -v golang.org/x/tools/cmd/vet
   113  # Grab Go's lint tool
   114  ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
   115  RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
   116  	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
   117  	&& go install -v github.com/golang/lint/golint
   118  
   119  # Configure the container for OSX cross compilation
   120  ENV OSX_SDK MacOSX10.11.sdk
   121  RUN set -x \
   122  	&& export OSXCROSS_PATH="/osxcross" \
   123  	&& git clone --depth 1 https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \
   124  	&& curl -sSL https://s3.dockerproject.org/darwin/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \
   125  	&& UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh
   126  ENV PATH /osxcross/target/bin:$PATH
   127  
   128  # install seccomp
   129  # this can be changed to the ubuntu package libseccomp-dev if dockerinit is removed,
   130  # we need libseccomp.a (which the package does not provide) for dockerinit
   131  ENV SECCOMP_VERSION v2.2.3
   132  RUN set -x \
   133  	&& export SECCOMP_PATH=$(mktemp -d) \
   134  	&& git clone https://github.com/seccomp/libseccomp.git "$SECCOMP_PATH" \
   135  	&& ( \
   136  		cd "$SECCOMP_PATH" \
   137  		&& git checkout "$SECCOMP_VERSION" \
   138  		&& ./autogen.sh \
   139  		&& ./configure --prefix=/usr \
   140  		&& make \
   141  		&& make install \
   142  	) \
   143  	&& rm -rf "$SECCOMP_PATH"
   144  
   145  # Install registry
   146  ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
   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  	&& rm -rf "$GOPATH"
   154  
   155  # Install notary server
   156  ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
   157  RUN set -x \
   158  	&& export GOPATH="$(mktemp -d)" \
   159  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   160  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
   161  	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
   162  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   163  	&& rm -rf "$GOPATH"
   164  
   165  # Get the "docker-py" source so we can run their integration tests
   166  ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
   167  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   168  	&& cd /docker-py \
   169  	&& git checkout -q $DOCKER_PY_COMMIT \
   170  	&& pip install -r test-requirements.txt
   171  
   172  # Setup s3cmd config
   173  RUN { \
   174  		echo '[default]'; \
   175  		echo 'access_key=$AWS_ACCESS_KEY'; \
   176  		echo 'secret_key=$AWS_SECRET_KEY'; \
   177  	} > ~/.s3cfg
   178  
   179  # Set user.email so crosbymichael's in-container merge commits go smoothly
   180  RUN git config --global user.email 'docker-dummy@example.com'
   181  
   182  # Add an unprivileged user to be used for tests which need it
   183  RUN groupadd -r docker
   184  RUN useradd --create-home --gid docker unprivilegeduser
   185  
   186  VOLUME /var/lib/docker
   187  WORKDIR /go/src/github.com/docker/docker
   188  ENV DOCKER_BUILDTAGS apparmor seccomp selinux
   189  
   190  # Let us use a .bashrc file
   191  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   192  
   193  # Register Docker's bash completion.
   194  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   195  
   196  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   197  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   198  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   199  	busybox:latest@sha256:eb3c0d4680f9213ee5f348ea6d39489a1f85a318a2ae09e012c426f78252a6d2 \
   200  	hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 \
   201  	jess/unshare:latest@sha256:2e3a8c0591c4690b82d4eba7e5ef8f49f2ddfe9f867f3e865198db9bd1436c5b
   202  # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   203  
   204  # Download man page generator
   205  RUN set -x \
   206  	&& export GOPATH="$(mktemp -d)" \
   207  	&& git clone -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
   208  	&& git clone -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
   209  	&& go get -v -d github.com/cpuguy83/go-md2man \
   210  	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
   211  	&& rm -rf "$GOPATH"
   212  
   213  # Download toml validator
   214  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   215  RUN set -x \
   216  	&& export GOPATH="$(mktemp -d)" \
   217  	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
   218  	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
   219  	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
   220  	&& rm -rf "$GOPATH"
   221  
   222  # Build/install the tool for embedding resources in Windows binaries
   223  ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
   224  RUN set -x \
   225      && git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
   226      && cd /go/src/github.com/akavel/rsrc \
   227      && git checkout -q $RSRC_COMMIT \
   228      && go install -v
   229  
   230  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   231  ENTRYPOINT ["hack/dind"]
   232  
   233  # Upload docker source
   234  COPY . /go/src/github.com/docker/docker