github.com/nalind/docker@v1.5.0/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  	btrfs-tools \
    35  	build-essential \
    36  	curl \
    37  	dpkg-sig \
    38  	git \
    39  	iptables \
    40  	libapparmor-dev \
    41  	libcap-dev \
    42  	libsqlite3-dev \
    43  	mercurial \
    44  	parallel \
    45  	python-mock \
    46  	python-pip \
    47  	python-websocket \
    48  	reprepro \
    49  	ruby1.9.1 \
    50  	ruby1.9.1-dev \
    51  	s3cmd=1.1.0* \
    52  	--no-install-recommends
    53  
    54  # Get lvm2 source for compiling statically
    55  RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
    56  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    57  
    58  # Compile and install lvm2
    59  RUN cd /usr/local/lvm2 \
    60  	&& ./configure --enable-static_link \
    61  	&& make device-mapper \
    62  	&& make install_device-mapper
    63  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    64  
    65  # Install lxc
    66  ENV LXC_VERSION 1.0.7
    67  RUN mkdir -p /usr/src/lxc \
    68  	&& curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
    69  RUN cd /usr/src/lxc \
    70  	&& ./configure \
    71  	&& make \
    72  	&& make install \
    73  	&& ldconfig
    74  
    75  # Install Go
    76  ENV GO_VERSION 1.4.1
    77  RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/local -xz \
    78  	&& mkdir -p /go/bin
    79  ENV PATH /go/bin:/usr/local/go/bin:$PATH
    80  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
    81  RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
    82  
    83  # Compile Go for cross compilation
    84  ENV DOCKER_CROSSPLATFORMS \
    85  	linux/386 linux/arm \
    86  	darwin/amd64 darwin/386 \
    87  	freebsd/amd64 freebsd/386 freebsd/arm
    88  
    89  # TODO when https://jenkins.dockerproject.com/job/Windows/ is green, add windows back to the list above
    90  #	windows/amd64 windows/386
    91  
    92  # (set an explicit GOARM of 5 for maximum compatibility)
    93  ENV GOARM 5
    94  RUN cd /usr/local/go/src \
    95  	&& set -x \
    96  	&& for platform in $DOCKER_CROSSPLATFORMS; do \
    97  		GOOS=${platform%/*} \
    98  		GOARCH=${platform##*/} \
    99  			./make.bash --no-clean 2>&1; \
   100  	done
   101  
   102  # We still support compiling with older Go, so need to grab older "gofmt"
   103  ENV GOFMT_VERSION 1.3.3
   104  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
   105  
   106  # Grab Go's cover tool for dead-simple code coverage testing
   107  RUN go get golang.org/x/tools/cmd/cover
   108  
   109  # TODO replace FPM with some very minimal debhelper stuff
   110  RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
   111  
   112  # Get the "busybox" image source so we can build locally instead of pulling
   113  RUN git clone -b buildroot-2014.02 https://github.com/jpetazzo/docker-busybox.git /docker-busybox
   114  
   115  # Get the "cirros" image source so we can import it instead of fetching it during tests
   116  RUN curl -sSL -o /cirros.tar.gz https://github.com/ewindisch/docker-cirros/raw/1cded459668e8b9dbf4ef976c94c05add9bbd8e9/cirros-0.3.0-x86_64-lxc.tar.gz
   117  
   118  # Install registry
   119  ENV REGISTRY_COMMIT c448e0416925a9876d5576e412703c9b8b865e19
   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 aa19d7b6609c6676e8258f6b900dea2eda1dbe95
   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 btrfs_noversion
   149  
   150  # Install man page generator
   151  COPY vendor /go/src/github.com/docker/docker/vendor
   152  # (copy vendor/ because go-md2man needs golang.org/x/net)
   153  RUN set -x \
   154  	&& git clone -b v1.0.1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
   155  	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
   156  	&& go install -v github.com/cpuguy83/go-md2man
   157  
   158  # install toml validator
   159  RUN git clone -b v0.1.0 https://github.com/BurntSushi/toml.git /go/src/github.com/BurntSushi/toml \
   160      && go install -v github.com/BurntSushi/toml/cmd/tomlv
   161  
   162  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   163  ENTRYPOINT ["hack/dind"]
   164  
   165  # Upload docker source
   166  COPY . /go/src/github.com/docker/docker