github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/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-unit test-integration-cli test-docker-py
    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  	libltdl-dev \
    40  	libsqlite3-dev \
    41  	libsystemd-dev \
    42  	mercurial \
    43  	net-tools \
    44  	parallel \
    45  	pkg-config \
    46  	python-dev \
    47  	python-mock \
    48  	python-pip \
    49  	python-websocket \
    50  	gccgo \
    51  	iproute2 \
    52  	iputils-ping \
    53  	--no-install-recommends
    54  
    55  # Install armhf loader to use armv6 binaries on armv8
    56  RUN dpkg --add-architecture armhf \
    57  	&& apt-get update \
    58  	&& apt-get install -y libc6:armhf
    59  
    60  # Get lvm2 source for compiling statically
    61  ENV LVM2_VERSION 2.02.103
    62  RUN mkdir -p /usr/local/lvm2 \
    63  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    64  		| tar -xzC /usr/local/lvm2 --strip-components=1
    65  # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    66  
    67  # Fix platform enablement in lvm2 to support aarch64 properly
    68  RUN set -e \
    69  	&& for f in config.guess config.sub; do \
    70  		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
    71  	done
    72  # "arch.c:78:2: error: #error the arch code needs to know about your machine type"
    73  
    74  # Compile and install lvm2
    75  RUN cd /usr/local/lvm2 \
    76  	&& ./configure \
    77  		--build="$(gcc -print-multiarch)" \
    78  		--enable-static_link \
    79  	&& make device-mapper \
    80  	&& make install_device-mapper
    81  # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    82  
    83  # Install seccomp: the version shipped in trusty is too old
    84  ENV SECCOMP_VERSION 2.3.1
    85  RUN set -x \
    86  	&& export SECCOMP_PATH="$(mktemp -d)" \
    87  	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
    88  		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
    89  	&& ( \
    90  		cd "$SECCOMP_PATH" \
    91  		&& ./configure --prefix=/usr/local \
    92  		&& make \
    93  		&& make install \
    94  		&& ldconfig \
    95  	) \
    96  	&& rm -rf "$SECCOMP_PATH"
    97  
    98  # Install Go
    99  # We don't have official binary tarballs for ARM64, eigher for Go or bootstrap,
   100  # so we use gccgo as bootstrap to build Go from source code.
   101  # We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
   102  # not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
   103  ENV GO_VERSION 1.7.3
   104  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 \
   105  	&& cd /usr/src/go/src \
   106  	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
   107  
   108  ENV PATH /usr/src/go/bin:$PATH
   109  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
   110  
   111  # Only install one version of the registry, because old version which support
   112  # schema1 manifests is not working on ARM64, we should skip integration-cli
   113  # tests for schema1 manifests on ARM64.
   114  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   115  RUN set -x \
   116  	&& export GOPATH="$(mktemp -d)" \
   117  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   118  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   119  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   120  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   121  	&& rm -rf "$GOPATH"
   122  
   123  # Install notary and notary-server
   124  ENV NOTARY_VERSION v0.4.2
   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 e2655f658408f9ad1f62abdef3eb6ed43c0cf324
   137  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   138  	&& cd /docker-py \
   139  	&& git checkout -q $DOCKER_PY_COMMIT \
   140  	&& pip install -r test-requirements.txt
   141  
   142  # Set user.email so crosbymichael's in-container merge commits go smoothly
   143  RUN git config --global user.email 'docker-dummy@example.com'
   144  
   145  # Add an unprivileged user to be used for tests which need it
   146  RUN groupadd -r docker
   147  RUN useradd --create-home --gid docker unprivilegeduser
   148  
   149  VOLUME /var/lib/docker
   150  WORKDIR /go/src/github.com/docker/docker
   151  ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
   152  
   153  # Let us use a .bashrc file
   154  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   155  
   156  # Register Docker's bash completion.
   157  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   158  
   159  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   160  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   161  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   162  	aarch64/buildpack-deps:jessie@sha256:6aa1d6910791b7ac78265fd0798e5abd6cb3f27ae992f6f960f6c303ec9535f2 \
   163  	aarch64/busybox:latest@sha256:b23a6a37cf269dff6e46d2473b6e227afa42b037e6d23435f1d2bc40fc8c2828 \
   164  	aarch64/debian:jessie@sha256:4be74a41a7c70ebe887b634b11ffe516cf4fcd56864a54941e56bb49883c3170 \
   165  	aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda
   166  # See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   167  
   168  # Install tomlv, runc, containerd, grimes, docker-proxy
   169  # Please edit hack/dockerfile/install-binaries.sh to update them.
   170  COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
   171  RUN /tmp/install-binaries.sh tomlv runc containerd grimes proxy
   172  
   173  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   174  ENTRYPOINT ["hack/dind"]
   175  
   176  # Upload docker source
   177  COPY . /go/src/github.com/docker/docker