github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/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-unit test-integration-cli test-docker-py
    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 debian:jessie
    27  
    28  # Add zfs ppa
    29  RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 \
    30  	|| apt-key adv --keyserver hkp://pgp.mit.edu: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  
    34  # Allow replacing httpredir mirror
    35  ARG APT_MIRROR=httpredir.debian.org
    36  RUN sed -i s/httpredir.debian.org/$APT_MIRROR/g /etc/apt/sources.list
    37  
    38  # Packaged dependencies
    39  RUN apt-get update && apt-get install -y \
    40  	apparmor \
    41  	apt-utils \
    42  	aufs-tools \
    43  	automake \
    44  	bash-completion \
    45  	binutils-mingw-w64 \
    46  	bsdmainutils \
    47  	btrfs-tools \
    48  	build-essential \
    49  	clang \
    50  	createrepo \
    51  	curl \
    52  	dpkg-sig \
    53  	gcc-mingw-w64 \
    54  	git \
    55  	iptables \
    56  	jq \
    57  	libapparmor-dev \
    58  	libcap-dev \
    59  	libltdl-dev \
    60  	libnl-3-dev \
    61  	libprotobuf-c0-dev \
    62  	libprotobuf-dev	\
    63  	libsqlite3-dev \
    64  	libsystemd-journal-dev \
    65  	libtool \
    66  	mercurial \
    67  	net-tools \
    68  	pkg-config \
    69  	protobuf-compiler \
    70  	protobuf-c-compiler \
    71  	python-dev \
    72  	python-mock \
    73  	python-pip \
    74  	python-websocket \
    75  	ubuntu-zfs \
    76  	xfsprogs \
    77  	libzfs-dev \
    78  	tar \
    79  	zip \
    80  	--no-install-recommends \
    81  	&& pip install awscli==1.10.15
    82  # Get lvm2 source for compiling statically
    83  ENV LVM2_VERSION 2.02.103
    84  RUN mkdir -p /usr/local/lvm2 \
    85  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    86  		| tar -xzC /usr/local/lvm2 --strip-components=1
    87  # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    88  
    89  # Compile and install lvm2
    90  RUN cd /usr/local/lvm2 \
    91  	&& ./configure \
    92  		--build="$(gcc -print-multiarch)" \
    93  		--enable-static_link \
    94  	&& make device-mapper \
    95  	&& make install_device-mapper
    96  # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    97  
    98  # Configure the container for OSX cross compilation
    99  ENV OSX_SDK MacOSX10.11.sdk
   100  ENV OSX_CROSS_COMMIT a9317c18a3a457ca0a657f08cc4d0d43c6cf8953
   101  RUN set -x \
   102  	&& export OSXCROSS_PATH="/osxcross" \
   103  	&& git clone https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \
   104  	&& ( cd $OSXCROSS_PATH && git checkout -q $OSX_CROSS_COMMIT) \
   105  	&& curl -sSL https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \
   106  	&& UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh
   107  ENV PATH /osxcross/target/bin:$PATH
   108  
   109  # Install seccomp: the version shipped in trusty is too old
   110  ENV SECCOMP_VERSION 2.3.1
   111  RUN set -x \
   112  	&& export SECCOMP_PATH="$(mktemp -d)" \
   113  	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
   114  		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
   115  	&& ( \
   116  		cd "$SECCOMP_PATH" \
   117  		&& ./configure --prefix=/usr/local \
   118  		&& make \
   119  		&& make install \
   120  		&& ldconfig \
   121  	) \
   122  	&& rm -rf "$SECCOMP_PATH"
   123  
   124  # Install Go
   125  # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
   126  #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
   127  #            with a heads-up.
   128  ENV GO_VERSION 1.7.1
   129  RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \
   130  	| tar -xzC /usr/local
   131  
   132  ENV PATH /go/bin:/usr/local/go/bin:$PATH
   133  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
   134  
   135  # Compile Go for cross compilation
   136  ENV DOCKER_CROSSPLATFORMS \
   137  	linux/386 linux/arm \
   138  	darwin/amd64 \
   139  	freebsd/amd64 freebsd/386 freebsd/arm \
   140  	windows/amd64 windows/386
   141  
   142  # Dependency for golint
   143  ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
   144  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   145  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT)
   146  
   147  # Grab Go's lint tool
   148  ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
   149  RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
   150  	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
   151  	&& go install -v github.com/golang/lint/golint
   152  
   153  # Install CRIU for checkpoint/restore support
   154  ENV CRIU_VERSION 2.2
   155  RUN mkdir -p /usr/src/criu \
   156  	&& curl -sSL https://github.com/xemul/criu/archive/v${CRIU_VERSION}.tar.gz | tar -v -C /usr/src/criu/ -xz --strip-components=1 \
   157  	&& cd /usr/src/criu \
   158  	&& make \
   159  	&& make install-criu
   160  
   161  # Install two versions of the registry. The first is an older version that
   162  # only supports schema1 manifests. The second is a newer version that supports
   163  # both. This allows integration-cli tests to cover push/pull with both schema1
   164  # and schema2 manifests.
   165  ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
   166  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   167  RUN set -x \
   168  	&& export GOPATH="$(mktemp -d)" \
   169  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   170  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   171  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   172  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   173  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
   174  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   175  		go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \
   176  	&& rm -rf "$GOPATH"
   177  
   178  # Install notary and notary-server
   179  ENV NOTARY_VERSION v0.3.0
   180  RUN set -x \
   181  	&& export GOPATH="$(mktemp -d)" \
   182  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   183  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   184  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   185  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   186  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   187  		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
   188  	&& rm -rf "$GOPATH"
   189  
   190  # Get the "docker-py" source so we can run their integration tests
   191  ENV DOCKER_PY_COMMIT e2655f658408f9ad1f62abdef3eb6ed43c0cf324
   192  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   193  	&& cd /docker-py \
   194  	&& git checkout -q $DOCKER_PY_COMMIT \
   195  	&& pip install -r test-requirements.txt
   196  
   197  # Set user.email so crosbymichael's in-container merge commits go smoothly
   198  RUN git config --global user.email 'docker-dummy@example.com'
   199  
   200  # Add an unprivileged user to be used for tests which need it
   201  RUN groupadd -r docker
   202  RUN useradd --create-home --gid docker unprivilegeduser
   203  
   204  VOLUME /var/lib/docker
   205  WORKDIR /go/src/github.com/docker/docker
   206  ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
   207  
   208  # Let us use a .bashrc file
   209  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   210  # Add integration helps to bashrc
   211  RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc
   212  
   213  # Register Docker's bash completion.
   214  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   215  
   216  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   217  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   218  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   219  	buildpack-deps:jessie@sha256:25785f89240fbcdd8a74bdaf30dd5599a9523882c6dfc567f2e9ef7cf6f79db6 \
   220  	busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \
   221  	debian:jessie@sha256:f968f10b4b523737e253a97eac59b0d1420b5c19b69928d35801a6373ffe330e \
   222  	hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
   223  # See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   224  
   225  # Download toml validator
   226  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   227  RUN set -x \
   228  	&& export GOPATH="$(mktemp -d)" \
   229  	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
   230  	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
   231  	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
   232  	&& rm -rf "$GOPATH"
   233  
   234  # Install runc
   235  ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28
   236  RUN set -x \
   237  	&& export GOPATH="$(mktemp -d)" \
   238  	&& git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
   239  	&& cd "$GOPATH/src/github.com/opencontainers/runc" \
   240  	&& git checkout -q "$RUNC_COMMIT" \
   241  	&& make static BUILDTAGS="seccomp apparmor selinux" \
   242  	&& cp runc /usr/local/bin/docker-runc \
   243  	&& rm -rf "$GOPATH"
   244  
   245  # Install containerd
   246  ENV CONTAINERD_COMMIT 2545227b0357eb55e369fa0072baef9ad91cdb69
   247  RUN set -x \
   248  	&& export GOPATH="$(mktemp -d)" \
   249  	&& git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
   250  	&& cd "$GOPATH/src/github.com/docker/containerd" \
   251  	&& git checkout -q "$CONTAINERD_COMMIT" \
   252  	&& make static \
   253  	&& cp bin/containerd /usr/local/bin/docker-containerd \
   254  	&& cp bin/containerd-shim /usr/local/bin/docker-containerd-shim \
   255  	&& cp bin/ctr /usr/local/bin/docker-containerd-ctr \
   256  	&& rm -rf "$GOPATH"
   257  
   258  ENV GRIMES_COMMIT f207601a8d19a534cc90d9e26e037e9931ccb9db
   259  RUN set -x \
   260      && export GOPATH="$(mktemp -d)" \
   261  	&& git clone https://github.com/crosbymichael/grimes.git "$GOPATH/grimes" \
   262  	&& cd "$GOPATH/grimes" \
   263  	&& git checkout -q "$GRIMES_COMMIT" \
   264  	&& make \
   265  	&& cp init /usr/local/bin/docker-init \
   266  	&& rm -rf "$GOPATH"
   267  
   268  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   269  ENTRYPOINT ["hack/dind"]
   270  
   271  # Upload docker source
   272  COPY . /go/src/github.com/docker/docker