github.com/rhatdan/docker@v0.7.7-0.20180119204836-47a0dcbcd20a/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 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:stretch
    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  	cmake \
    44  	createrepo \
    45  	curl \
    46  	dpkg-sig \
    47  	gcc-mingw-w64 \
    48  	git \
    49  	iptables \
    50  	jq \
    51  	less \
    52  	libapparmor-dev \
    53  	libcap-dev \
    54  	libdevmapper-dev \
    55  	libnet-dev \
    56  	libnl-3-dev \
    57  	libprotobuf-c0-dev \
    58  	libprotobuf-dev \
    59  	libseccomp-dev \
    60  	libsystemd-dev \
    61  	libtool \
    62  	libudev-dev \
    63  	mercurial \
    64  	net-tools \
    65  	pigz \
    66  	pkg-config \
    67  	protobuf-compiler \
    68  	protobuf-c-compiler \
    69  	python-backports.ssl-match-hostname \
    70  	python-dev \
    71  	python-mock \
    72  	python-pip \
    73  	python-requests \
    74  	python-setuptools \
    75  	python-websocket \
    76  	python-wheel \
    77  	tar \
    78  	thin-provisioning-tools \
    79  	vim \
    80  	vim-common \
    81  	xfsprogs \
    82  	zip \
    83  	--no-install-recommends \
    84  	&& pip install awscli==1.10.15
    85  
    86  # Install Go
    87  # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
    88  #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
    89  #            with a heads-up.
    90  # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
    91  ENV GO_VERSION 1.9.2
    92  RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
    93  	| tar -xzC /usr/local
    94  
    95  ENV PATH /go/bin:/usr/local/go/bin:$PATH
    96  ENV GOPATH /go
    97  
    98  # Install CRIU for checkpoint/restore support
    99  ENV CRIU_VERSION 3.6
   100  RUN mkdir -p /usr/src/criu \
   101  	&& curl -sSL https://github.com/checkpoint-restore/criu/archive/v${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \
   102  	&& cd /usr/src/criu \
   103  	&& make \
   104  	&& make install-criu
   105  
   106  # Install two versions of the registry. The first is an older version that
   107  # only supports schema1 manifests. The second is a newer version that supports
   108  # both. This allows integration-cli tests to cover push/pull with both schema1
   109  # and schema2 manifests.
   110  ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
   111  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   112  RUN set -x \
   113  	&& export GOPATH="$(mktemp -d)" \
   114  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   115  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   116  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   117  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   118  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
   119  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   120  		go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \
   121  	&& rm -rf "$GOPATH"
   122  
   123  # Install notary and notary-server
   124  ENV NOTARY_VERSION v0.5.0
   125  RUN set -x \
   126  	&& export GOPATH="$(mktemp -d)" \
   127  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   128  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   129  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   130  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   131  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   132  		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
   133  	&& rm -rf "$GOPATH"
   134  
   135  # Get the "docker-py" source so we can run their integration tests
   136  ENV DOCKER_PY_COMMIT 1d6b5b203222ba5df7dedfcd1ee061a452f99c8a
   137  # To run integration tests docker-pycreds is required.
   138  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   139  	&& cd /docker-py \
   140  	&& git checkout -q $DOCKER_PY_COMMIT \
   141  	&& pip install docker-pycreds==0.2.1 \
   142  	&& pip install -r test-requirements.txt
   143  
   144  # Install yamllint for validating swagger.yaml
   145  RUN pip install yamllint==1.5.0
   146  
   147  # Install go-swagger for validating swagger.yaml
   148  ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
   149  RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \
   150  	&& (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \
   151  	&& go install -v github.com/go-swagger/go-swagger/cmd/swagger
   152  
   153  # Set user.email so crosbymichael's in-container merge commits go smoothly
   154  RUN git config --global user.email 'docker-dummy@example.com'
   155  
   156  # Add an unprivileged user to be used for tests which need it
   157  RUN groupadd -r docker
   158  RUN useradd --create-home --gid docker unprivilegeduser
   159  
   160  VOLUME /var/lib/docker
   161  WORKDIR /go/src/github.com/docker/docker
   162  ENV DOCKER_BUILDTAGS apparmor seccomp selinux
   163  
   164  # Let us use a .bashrc file
   165  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   166  # Add integration helps to bashrc
   167  RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc
   168  
   169  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   170  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   171  # TODO: when issue #35963 fixed, we can upgrade the busybox to multi-arch
   172  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   173  	buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
   174  	busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f \
   175  	debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
   176  	hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
   177  # See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
   178  
   179  # Install tomlv, vndr, runc, containerd, tini, docker-proxy dockercli
   180  # Please edit hack/dockerfile/install-binaries.sh to update them.
   181  COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
   182  COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
   183  RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter
   184  ENV PATH=/usr/local/cli:$PATH
   185  
   186  # Activate bash completion and include Docker's completion if mounted with DOCKER_BASH_COMPLETION_PATH
   187  RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc
   188  RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker
   189  
   190  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   191  ENTRYPOINT ["hack/dind"]
   192  
   193  # Options for hack/validate/gometalinter
   194  ENV GOMETALINTER_OPTS="--deadline=2m"
   195  
   196  # Upload docker source
   197  COPY . /go/src/github.com/docker/docker
   198