github.com/codemac/docker@v1.2.1-0.20150518222241-6a18412d5b9c/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 pool.sks-keyservers.net --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  	curl \
    41  	dpkg-sig \
    42  	git \
    43  	iptables \
    44  	libapparmor-dev \
    45  	libcap-dev \
    46  	libsqlite3-dev \
    47  	mercurial \
    48  	parallel \
    49  	python-mock \
    50  	python-pip \
    51  	python-websocket \
    52  	reprepro \
    53  	ruby1.9.1 \
    54  	ruby1.9.1-dev \
    55  	s3cmd=1.1.0* \
    56  	ubuntu-zfs \
    57  	libzfs-dev \
    58  	--no-install-recommends
    59  
    60  # Get lvm2 source for compiling statically
    61  RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
    62  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    63  
    64  # Compile and install lvm2
    65  RUN cd /usr/local/lvm2 \
    66  	&& ./configure --enable-static_link \
    67  	&& make device-mapper \
    68  	&& make install_device-mapper
    69  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    70  
    71  # Install lxc
    72  ENV LXC_VERSION 1.0.7
    73  RUN mkdir -p /usr/src/lxc \
    74  	&& curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
    75  RUN cd /usr/src/lxc \
    76  	&& ./configure \
    77  	&& make \
    78  	&& make install \
    79  	&& ldconfig
    80  
    81  # Install Go
    82  ENV GO_VERSION 1.4.2
    83  RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/local -xz \
    84  	&& mkdir -p /go/bin
    85  ENV PATH /go/bin:/usr/local/go/bin:$PATH
    86  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
    87  RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
    88  
    89  # Compile Go for cross compilation
    90  ENV DOCKER_CROSSPLATFORMS \
    91  	linux/386 linux/arm \
    92  	darwin/amd64 darwin/386 \
    93  	freebsd/amd64 freebsd/386 freebsd/arm \
    94  	windows/amd64 windows/386
    95  
    96  # (set an explicit GOARM of 5 for maximum compatibility)
    97  ENV GOARM 5
    98  RUN cd /usr/local/go/src \
    99  	&& set -x \
   100  	&& for platform in $DOCKER_CROSSPLATFORMS; do \
   101  		GOOS=${platform%/*} \
   102  		GOARCH=${platform##*/} \
   103  			./make.bash --no-clean 2>&1; \
   104  	done
   105  
   106  # This has been commented out and kept as reference because we don't support compiling with older Go anymore.
   107  # ENV GOFMT_VERSION 1.3.3
   108  # 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
   109  
   110  # Update this sha when we upgrade to go 1.5.0
   111  ENV GO_TOOLS_COMMIT 069d2f3bcb68257b627205f0486d6cc69a231ff9
   112  # Grab Go's cover tool for dead-simple code coverage testing
   113  # Grab Go's vet tool for examining go code to find suspicious constructs
   114  # and help prevent errors that the compiler might not catch
   115  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   116  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
   117  	&& go install -v golang.org/x/tools/cmd/cover \
   118  	&& go install -v golang.org/x/tools/cmd/vet
   119  
   120  # TODO replace FPM with some very minimal debhelper stuff
   121  RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
   122  
   123  # Install registry
   124  ENV REGISTRY_COMMIT d957768537c5af40e4f4cd96871f7b2bde9e2923
   125  RUN set -x \
   126  	&& git clone https://github.com/docker/distribution.git /go/src/github.com/docker/distribution \
   127  	&& (cd /go/src/github.com/docker/distribution && git checkout -q $REGISTRY_COMMIT) \
   128  	&& GOPATH=/go/src/github.com/docker/distribution/Godeps/_workspace:/go \
   129  		go build -o /go/bin/registry-v2 github.com/docker/distribution/cmd/registry
   130  
   131  # Get the "docker-py" source so we can run their integration tests
   132  ENV DOCKER_PY_COMMIT 91985b239764fe54714fa0a93d52aa362357d251
   133  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   134  	&& cd /docker-py \
   135  	&& git checkout -q $DOCKER_PY_COMMIT
   136  
   137  # Setup s3cmd config
   138  RUN { \
   139  		echo '[default]'; \
   140  		echo 'access_key=$AWS_ACCESS_KEY'; \
   141  		echo 'secret_key=$AWS_SECRET_KEY'; \
   142  	} > ~/.s3cfg
   143  
   144  # Set user.email so crosbymichael's in-container merge commits go smoothly
   145  RUN git config --global user.email 'docker-dummy@example.com'
   146  
   147  # Add an unprivileged user to be used for tests which need it
   148  RUN groupadd -r docker
   149  RUN useradd --create-home --gid docker unprivilegeduser
   150  
   151  VOLUME /var/lib/docker
   152  WORKDIR /go/src/github.com/docker/docker
   153  ENV DOCKER_BUILDTAGS apparmor selinux
   154  
   155  # Let us use a .bashrc file
   156  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   157  
   158  # Register Docker's bash completion.
   159  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   160  
   161  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   162  COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
   163  RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
   164  	busybox:latest@4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125 \
   165  	hello-world:frozen@e45a5af57b00862e5ef5782a9925979a02ba2b12dff832fd0991335f4a11e5c5
   166  # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   167  
   168  # Download man page generator
   169  RUN set -x \
   170  	&& git clone -b v1.0.1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
   171  	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday
   172  
   173  # Download toml validator
   174  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   175  RUN set -x \
   176  	&& git clone https://github.com/BurntSushi/toml.git /go/src/github.com/BurntSushi/toml \
   177  	&& (cd /go/src/github.com/BurntSushi/toml && git checkout -q $TOMLV_COMMIT)
   178  
   179  # copy vendor/ because go-md2man needs golang.org/x/net
   180  COPY vendor /go/src/github.com/docker/docker/vendor
   181  RUN go install -v github.com/cpuguy83/go-md2man \
   182  	github.com/BurntSushi/toml/cmd/tomlv
   183  
   184  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   185  ENTRYPOINT ["hack/dind"]
   186  
   187  # Upload docker source
   188  COPY . /go/src/github.com/docker/docker