github.com/akerouanton/docker@v1.11.0-rc3/Dockerfile.aarch64 (about)

     1  # This file describes the standard way to build Docker on aarch64, using docker
     2  #
     3  # Usage:
     4  #
     5  # # Assemble the full dev environment. This is slow the first time.
     6  # docker build -t docker -f Dockerfile.aarch64 .
     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  # Note: AppArmor used to mess with privileged mode, but this is no longer
    15  # the case. Therefore, you don't have to disable it anymore.
    16  #
    17  
    18  FROM aarch64/ubuntu:wily
    19  
    20  # Packaged dependencies
    21  RUN apt-get update && apt-get install -y \
    22  	apparmor \
    23  	aufs-tools \
    24  	automake \
    25  	bash-completion \
    26  	btrfs-tools \
    27  	build-essential \
    28  	createrepo \
    29  	curl \
    30  	dpkg-sig \
    31  	g++ \
    32  	gcc \
    33  	git \
    34  	iptables \
    35  	jq \
    36  	libapparmor-dev \
    37  	libc6-dev \
    38  	libcap-dev \
    39  	libsqlite3-dev \
    40  	libsystemd-dev \
    41  	mercurial \
    42  	net-tools \
    43  	parallel \
    44  	pkg-config \
    45  	python-dev \
    46  	python-mock \
    47  	python-pip \
    48  	python-websocket \
    49  	gccgo \
    50  	--no-install-recommends
    51  
    52  # Install armhf loader to use armv6 binaries on armv8
    53  RUN dpkg --add-architecture armhf \
    54  	&& apt-get update \
    55  	&& apt-get install -y libc6:armhf
    56  
    57  # Get lvm2 source for compiling statically
    58  ENV LVM2_VERSION 2.02.103
    59  RUN mkdir -p /usr/local/lvm2 \
    60  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    61  		| tar -xzC /usr/local/lvm2 --strip-components=1
    62  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    63  
    64  # fix platform enablement in lvm2 to support aarch64 properly
    65  RUN set -e \
    66  	&& for f in config.guess config.sub; do \
    67  		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
    68  	done
    69  # "arch.c:78:2: error: #error the arch code needs to know about your machine type"
    70  
    71  # Compile and install lvm2
    72  RUN cd /usr/local/lvm2 \
    73  	&& ./configure \
    74  		--build="$(gcc -print-multiarch)" \
    75  		--enable-static_link \
    76  	&& make device-mapper \
    77  	&& make install_device-mapper
    78  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    79  
    80  # install seccomp: the version shipped in trusty is too old
    81  ENV SECCOMP_VERSION 2.3.0
    82  RUN set -x \
    83  	&& export SECCOMP_PATH="$(mktemp -d)" \
    84  	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
    85  		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
    86  	&& ( \
    87  		cd "$SECCOMP_PATH" \
    88  		&& ./configure --prefix=/usr/local \
    89  		&& make \
    90  		&& make install \
    91  		&& ldconfig \
    92  	) \
    93  	&& rm -rf "$SECCOMP_PATH"
    94  
    95  # Install Go
    96  # We don't have official binary tarballs for ARM64, eigher for Go or bootstrap,
    97  # so we use the official armv6 released binaries as a GOROOT_BOOTSTRAP, and
    98  # build Go from source code.
    99  ENV GO_VERSION 1.5.3
   100  RUN mkdir /usr/src/go && curl -fsSL https://storage.googleapis.com/golang/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \
   101  	&& cd /usr/src/go/src \
   102  	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
   103  
   104  ENV PATH /usr/src/go/bin:$PATH
   105  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
   106  
   107  # Only install one version of the registry, because old version which support
   108  # schema1 manifests is not working on ARM64, we should skip integration-cli
   109  # tests for schema1 manifests on ARM64.
   110  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   111  RUN set -x \
   112  	&& export GOPATH="$(mktemp -d)" \
   113  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   114  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   115  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   116  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   117  	&& rm -rf "$GOPATH"
   118  
   119  # Install notary server
   120  ENV NOTARY_VERSION docker-v1.11-3
   121  RUN set -x \
   122  	&& export GO15VENDOREXPERIMENT=1 \
   123  	&& export GOPATH="$(mktemp -d)" \
   124  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   125  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   126  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   127  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   128  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   129  		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
   130  	&& rm -rf "$GOPATH"
   131  
   132  # Get the "docker-py" source so we can run their integration tests
   133  ENV DOCKER_PY_COMMIT e2878cbcc3a7eef99917adc1be252800b0e41ece
   134  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   135  	&& cd /docker-py \
   136  	&& git checkout -q $DOCKER_PY_COMMIT \
   137  	&& pip install -r test-requirements.txt
   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 pkcs11 seccomp 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-v2.sh /go/src/github.com/docker/docker/contrib/
   158  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   159  	aarch64/buildpack-deps:jessie@sha256:6aa1d6910791b7ac78265fd0798e5abd6cb3f27ae992f6f960f6c303ec9535f2 \
   160  	aarch64/busybox:latest@sha256:b23a6a37cf269dff6e46d2473b6e227afa42b037e6d23435f1d2bc40fc8c2828 \
   161  	aarch64/debian:jessie@sha256:4be74a41a7c70ebe887b634b11ffe516cf4fcd56864a54941e56bb49883c3170 \
   162  	aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda
   163  # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   164  
   165  # Download man page generator
   166  RUN set -x \
   167  	&& export GOPATH="$(mktemp -d)" \
   168  	&& git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
   169  	&& git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
   170  	&& go get -v -d github.com/cpuguy83/go-md2man \
   171  	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
   172  	&& rm -rf "$GOPATH"
   173  
   174  # Download toml validator
   175  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   176  RUN set -x \
   177  	&& export GOPATH="$(mktemp -d)" \
   178  	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
   179  	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
   180  	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
   181  	&& rm -rf "$GOPATH"
   182  
   183  # Install runc
   184  ENV RUNC_COMMIT 0c1c615ebd6a15545b6a82ead01d2745ea49b242
   185  RUN set -x \
   186  	&& export GOPATH="$(mktemp -d)" \
   187  	&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
   188  	&& cd "$GOPATH/src/github.com/opencontainers/runc" \
   189  	&& git checkout -q "$RUNC_COMMIT" \
   190  	&& make static BUILDTAGS="seccomp apparmor selinux" \
   191  	&& cp runc /usr/local/bin/docker-runc
   192  
   193  # Install containerd
   194  ENV CONTAINERD_COMMIT 07c95162cdcead88dfe4ca0ffb3cea02375ec54d
   195  RUN set -x \
   196  	&& export GOPATH="$(mktemp -d)" \
   197  	&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
   198  	&& cd "$GOPATH/src/github.com/docker/containerd" \
   199  	&& git checkout -q "$CONTAINERD_COMMIT" \
   200  	&& make static \
   201  	&& cp bin/containerd /usr/local/bin/docker-containerd \
   202  	&& cp bin/containerd-shim /usr/local/bin/docker-containerd-shim \
   203  	&& cp bin/ctr /usr/local/bin/docker-containerd-ctr
   204  
   205  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   206  ENTRYPOINT ["hack/dind"]
   207  
   208  # Upload docker source
   209  COPY . /go/src/github.com/docker/docker