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