github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/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 -e DOCKER_GITCOMMIT=foo --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  # allow replacing httpredir or deb mirror
    29  ARG APT_MIRROR=deb.debian.org
    30  RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
    31  
    32  # Packaged dependencies
    33  RUN apt-get update && apt-get install -y \
    34  	apparmor \
    35  	apt-utils \
    36  	aufs-tools \
    37  	automake \
    38  	bash-completion \
    39  	binutils-mingw-w64 \
    40  	bsdmainutils \
    41  	btrfs-tools \
    42  	build-essential \
    43  	clang \
    44  	cmake \
    45  	createrepo \
    46  	curl \
    47  	dpkg-sig \
    48  	gcc-mingw-w64 \
    49  	git \
    50  	iptables \
    51  	jq \
    52  	less \
    53  	libapparmor-dev \
    54  	libcap-dev \
    55  	libltdl-dev \
    56  	libnl-3-dev \
    57  	libprotobuf-c0-dev \
    58  	libprotobuf-dev \
    59  	libsystemd-journal-dev \
    60  	libtool \
    61  	mercurial \
    62  	net-tools \
    63  	pkg-config \
    64  	protobuf-compiler \
    65  	protobuf-c-compiler \
    66  	python-dev \
    67  	python-mock \
    68  	python-pip \
    69  	python-websocket \
    70  	tar \
    71  	vim \
    72  	vim-common \
    73  	xfsprogs \
    74  	zip \
    75  	--no-install-recommends \
    76  	&& pip install awscli==1.10.15
    77  # Get lvm2 source for compiling statically
    78  ENV LVM2_VERSION 2.02.103
    79  RUN mkdir -p /usr/local/lvm2 \
    80  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    81  		| tar -xzC /usr/local/lvm2 --strip-components=1
    82  # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    83  
    84  # Compile and install lvm2
    85  RUN cd /usr/local/lvm2 \
    86  	&& ./configure \
    87  		--build="$(gcc -print-multiarch)" \
    88  		--enable-static_link \
    89  	&& make device-mapper \
    90  	&& make install_device-mapper
    91  # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    92  
    93  # Configure the container for OSX cross compilation
    94  ENV OSX_SDK MacOSX10.11.sdk
    95  ENV OSX_CROSS_COMMIT a9317c18a3a457ca0a657f08cc4d0d43c6cf8953
    96  RUN set -x \
    97  	&& export OSXCROSS_PATH="/osxcross" \
    98  	&& git clone https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \
    99  	&& ( cd $OSXCROSS_PATH && git checkout -q $OSX_CROSS_COMMIT) \
   100  	&& curl -sSL https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \
   101  	&& UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh
   102  ENV PATH /osxcross/target/bin:$PATH
   103  
   104  # Install seccomp: the version shipped upstream is too old
   105  ENV SECCOMP_VERSION 2.3.2
   106  RUN set -x \
   107  	&& export SECCOMP_PATH="$(mktemp -d)" \
   108  	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
   109  		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
   110  	&& ( \
   111  		cd "$SECCOMP_PATH" \
   112  		&& ./configure --prefix=/usr/local \
   113  		&& make \
   114  		&& make install \
   115  		&& ldconfig \
   116  	) \
   117  	&& rm -rf "$SECCOMP_PATH"
   118  
   119  # Install Go
   120  # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
   121  #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
   122  #            with a heads-up.
   123  ENV GO_VERSION 1.8.3
   124  RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
   125  	| tar -xzC /usr/local
   126  
   127  ENV PATH /go/bin:/usr/local/go/bin:$PATH
   128  ENV GOPATH /go
   129  
   130  # Compile Go for cross compilation
   131  ENV DOCKER_CROSSPLATFORMS \
   132  	linux/386 linux/arm \
   133  	darwin/amd64 \
   134  	freebsd/amd64 freebsd/386 freebsd/arm \
   135  	windows/amd64 windows/386 \
   136  	solaris/amd64
   137  
   138  # Dependency for golint
   139  ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
   140  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   141  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT)
   142  
   143  # Grab Go's lint tool
   144  ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
   145  RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
   146  	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
   147  	&& go install -v github.com/golang/lint/golint
   148  
   149  # Install CRIU for checkpoint/restore support
   150  ENV CRIU_VERSION 2.12.1
   151  # Install dependancy packages specific to criu
   152  RUN apt-get install libnet-dev -y && \
   153  	mkdir -p /usr/src/criu \
   154  	&& curl -sSL https://github.com/xemul/criu/archive/v${CRIU_VERSION}.tar.gz | tar -v -C /usr/src/criu/ -xz --strip-components=1 \
   155  	&& cd /usr/src/criu \
   156  	&& make \
   157  	&& make install-criu
   158  
   159  # Install two versions of the registry. The first is an older version that
   160  # only supports schema1 manifests. The second is a newer version that supports
   161  # both. This allows integration-cli tests to cover push/pull with both schema1
   162  # and schema2 manifests.
   163  ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
   164  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   165  RUN set -x \
   166  	&& export GOPATH="$(mktemp -d)" \
   167  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   168  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   169  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   170  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   171  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
   172  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   173  		go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \
   174  	&& rm -rf "$GOPATH"
   175  
   176  # Install notary and notary-server
   177  ENV NOTARY_VERSION v0.5.0
   178  RUN set -x \
   179  	&& export GOPATH="$(mktemp -d)" \
   180  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   181  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   182  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   183  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   184  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   185  		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
   186  	&& rm -rf "$GOPATH"
   187  
   188  # Get the "docker-py" source so we can run their integration tests
   189  ENV DOCKER_PY_COMMIT 4a08d04aef0595322e1b5ac7c52f28a931da85a5
   190  # To run integration tests docker-pycreds is required.
   191  # Before running the integration tests conftest.py is
   192  # loaded which results in loads auth.py that
   193  # imports the docker-pycreds module.
   194  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   195  	&& cd /docker-py \
   196  	&& git checkout -q $DOCKER_PY_COMMIT \
   197  	&& pip install docker-pycreds==0.2.1 \
   198  	&& pip install -r test-requirements.txt
   199  
   200  # Install yamllint for validating swagger.yaml
   201  RUN pip install yamllint==1.5.0
   202  
   203  # Install go-swagger for validating swagger.yaml
   204  ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
   205  RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \
   206  	&& (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \
   207  	&& go install -v github.com/go-swagger/go-swagger/cmd/swagger
   208  
   209  # Set user.email so crosbymichael's in-container merge commits go smoothly
   210  RUN git config --global user.email 'docker-dummy@example.com'
   211  
   212  # Add an unprivileged user to be used for tests which need it
   213  RUN groupadd -r docker
   214  RUN useradd --create-home --gid docker unprivilegeduser
   215  
   216  VOLUME /var/lib/docker
   217  WORKDIR /go/src/github.com/docker/docker
   218  ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
   219  
   220  # Let us use a .bashrc file
   221  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   222  # Add integration helps to bashrc
   223  RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc
   224  
   225  # Register Docker's bash completion.
   226  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   227  
   228  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   229  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   230  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   231  	buildpack-deps:jessie@sha256:85b379ec16065e4fe4127eb1c5fb1bcc03c559bd36dbb2e22ff496de55925fa6 \
   232  	busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \
   233  	debian:jessie@sha256:72f784399fd2719b4cb4e16ef8e369a39dc67f53d978cd3e2e7bf4e502c7b793 \
   234  	hello-world:latest@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
   235  # See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
   236  
   237  # Install tomlv, vndr, runc, containerd, tini, docker-proxy dockercli
   238  # Please edit hack/dockerfile/install-binaries.sh to update them.
   239  COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
   240  COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
   241  RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy bindata dockercli
   242  ENV PATH=/usr/local/cli:$PATH
   243  
   244  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   245  ENTRYPOINT ["hack/dind"]
   246  
   247  # Upload docker source
   248  COPY . /go/src/github.com/docker/docker