github.com/rsampaio/docker@v0.7.2-0.20150827203920-fdc73cc3fc31/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  RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
    30  RUN	echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
    31  
    32  # Packaged dependencies
    33  RUN apt-get update && apt-get install -y \
    34  	apparmor \
    35  	aufs-tools \
    36  	automake \
    37  	bash-completion \
    38  	btrfs-tools \
    39  	build-essential \
    40  	createrepo \
    41  	curl \
    42  	dpkg-sig \
    43  	gcc-mingw-w64 \
    44  	git \
    45  	iptables \
    46  	libapparmor-dev \
    47  	libcap-dev \
    48  	libsqlite3-dev \
    49  	mercurial \
    50  	parallel \
    51  	python-mock \
    52  	python-pip \
    53  	python-websocket \
    54  	reprepro \
    55  	ruby1.9.1 \
    56  	ruby1.9.1-dev \
    57  	s3cmd=1.1.0* \
    58  	ubuntu-zfs \
    59  	libzfs-dev \
    60  	--no-install-recommends
    61  
    62  # Get lvm2 source for compiling statically
    63  RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
    64  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    65  
    66  # Compile and install lvm2
    67  RUN cd /usr/local/lvm2 \
    68  	&& ./configure --enable-static_link \
    69  	&& make device-mapper \
    70  	&& make install_device-mapper
    71  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    72  
    73  # Install lxc
    74  ENV LXC_VERSION 1.1.2
    75  RUN mkdir -p /usr/src/lxc \
    76  	&& curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
    77  RUN cd /usr/src/lxc \
    78  	&& ./configure \
    79  	&& make \
    80  	&& make install \
    81  	&& ldconfig
    82  
    83  # Install Go
    84  ENV GO_VERSION 1.4.2
    85  RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/local -xz \
    86  	&& mkdir -p /go/bin
    87  ENV PATH /go/bin:/usr/local/go/bin:$PATH
    88  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
    89  RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
    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  RUN cd /usr/local/go/src \
   101  	&& set -x \
   102  	&& for platform in $DOCKER_CROSSPLATFORMS; do \
   103  		GOOS=${platform%/*} \
   104  		GOARCH=${platform##*/} \
   105  			./make.bash --no-clean 2>&1; \
   106  	done
   107  
   108  # This has been commented out and kept as reference because we don't support compiling with older Go anymore.
   109  # ENV GOFMT_VERSION 1.3.3
   110  # 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
   111  
   112  # Update this sha when we upgrade to go 1.5.0
   113  ENV GO_TOOLS_COMMIT 069d2f3bcb68257b627205f0486d6cc69a231ff9
   114  # Grab Go's cover tool for dead-simple code coverage testing
   115  # Grab Go's vet tool for examining go code to find suspicious constructs
   116  # and help prevent errors that the compiler might not catch
   117  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   118  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
   119  	&& go install -v golang.org/x/tools/cmd/cover \
   120  	&& go install -v golang.org/x/tools/cmd/vet
   121  # Grab Go's lint tool
   122  ENV GO_LINT_COMMIT f42f5c1c440621302702cb0741e9d2ca547ae80f
   123  RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
   124  	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
   125  	&& go install -v github.com/golang/lint/golint
   126  
   127  # TODO replace FPM with some very minimal debhelper stuff
   128  RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
   129  
   130  # Install registry
   131  ENV REGISTRY_COMMIT 2317f721a3d8428215a2b65da4ae85212ed473b4
   132  RUN set -x \
   133  	&& export GOPATH="$(mktemp -d)" \
   134  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   135  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   136  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   137  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   138  	&& rm -rf "$GOPATH"
   139  
   140  # Install notary server
   141  ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
   142  RUN set -x \
   143  	&& export GOPATH="$(mktemp -d)" \
   144  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   145  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
   146  	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
   147  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   148  	&& rm -rf "$GOPATH"
   149  
   150  # Get the "docker-py" source so we can run their integration tests
   151  ENV DOCKER_PY_COMMIT 139850f3f3b17357bab5ba3edfb745fb14043764
   152  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   153  	&& cd /docker-py \
   154  	&& git checkout -q $DOCKER_PY_COMMIT
   155  
   156  # Setup s3cmd config
   157  RUN { \
   158  		echo '[default]'; \
   159  		echo 'access_key=$AWS_ACCESS_KEY'; \
   160  		echo 'secret_key=$AWS_SECRET_KEY'; \
   161  	} > ~/.s3cfg
   162  
   163  # Set user.email so crosbymichael's in-container merge commits go smoothly
   164  RUN git config --global user.email 'docker-dummy@example.com'
   165  
   166  # Add an unprivileged user to be used for tests which need it
   167  RUN groupadd -r docker
   168  RUN useradd --create-home --gid docker unprivilegeduser
   169  
   170  VOLUME /var/lib/docker
   171  WORKDIR /go/src/github.com/docker/docker
   172  ENV DOCKER_BUILDTAGS apparmor selinux
   173  
   174  # Let us use a .bashrc file
   175  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   176  
   177  # Register Docker's bash completion.
   178  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   179  
   180  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   181  COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
   182  RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
   183  	busybox:latest@8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55 \
   184  	hello-world:frozen@91c95931e552b11604fea91c2f537284149ec32fff0f700a4769cfd31d7696ae \
   185  	jess/unshare@5c9f6ea50341a2a8eb6677527f2bdedbf331ae894a41714fda770fb130f3314d
   186  # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   187  
   188  # Download man page generator
   189  RUN set -x \
   190  	&& export GOPATH="$(mktemp -d)" \
   191  	&& git clone -b v1.0.3 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
   192  	&& git clone -b v1.2 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
   193  	&& go get -v -d github.com/cpuguy83/go-md2man \
   194  	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
   195  	&& rm -rf "$GOPATH"
   196  
   197  # Download toml validator
   198  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   199  RUN set -x \
   200  	&& export GOPATH="$(mktemp -d)" \
   201  	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
   202  	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
   203  	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
   204  	&& rm -rf "$GOPATH"
   205  
   206  # Build/install the tool for embedding resources in Windows binaries
   207  ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
   208  RUN set -x \
   209      && git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
   210      && cd /go/src/github.com/akavel/rsrc \
   211      && git checkout -q $RSRC_COMMIT \
   212      && go install -v
   213  
   214  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   215  ENTRYPOINT ["hack/dind"]
   216  
   217  # Upload docker source
   218  COPY . /go/src/github.com/docker/docker