github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/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:xenial
    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  	cmake \
    29  	createrepo \
    30  	curl \
    31  	dpkg-sig \
    32  	g++ \
    33  	gcc \
    34  	git \
    35  	iptables \
    36  	jq \
    37  	libapparmor-dev \
    38  	libc6-dev \
    39  	libcap-dev \
    40  	libltdl-dev \
    41  	libsystemd-dev \
    42  	libyaml-dev \
    43  	mercurial \
    44  	net-tools \
    45  	parallel \
    46  	pkg-config \
    47  	python-dev \
    48  	python-mock \
    49  	python-pip \
    50  	python-setuptools \
    51  	python-websocket \
    52  	golang-go \
    53  	iproute2 \
    54  	iputils-ping \
    55  	vim-common \
    56  	--no-install-recommends
    57  
    58  # Get lvm2 source for compiling statically
    59  ENV LVM2_VERSION 2.02.103
    60  RUN mkdir -p /usr/local/lvm2 \
    61  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    62  		| tar -xzC /usr/local/lvm2 --strip-components=1
    63  # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    64  
    65  # Fix platform enablement in lvm2 to support aarch64 properly
    66  RUN set -e \
    67  	&& for f in config.guess config.sub; do \
    68  		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
    69  	done
    70  # "arch.c:78:2: error: #error the arch code needs to know about your machine type"
    71  
    72  # Compile and install lvm2
    73  RUN cd /usr/local/lvm2 \
    74  	&& ./configure \
    75  		--build="$(gcc -print-multiarch)" \
    76  		--enable-static_link \
    77  	&& make device-mapper \
    78  	&& make install_device-mapper
    79  # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    80  
    81  # Install seccomp: the version shipped upstream is too old
    82  ENV SECCOMP_VERSION 2.3.2
    83  RUN set -x \
    84  	&& export SECCOMP_PATH="$(mktemp -d)" \
    85  	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
    86  		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
    87  	&& ( \
    88  		cd "$SECCOMP_PATH" \
    89  		&& ./configure --prefix=/usr/local \
    90  		&& make \
    91  		&& make install \
    92  		&& ldconfig \
    93  	) \
    94  	&& rm -rf "$SECCOMP_PATH"
    95  
    96  # Install Go
    97  # We don't have official binary golang 1.7.5 tarballs for ARM64, eigher for Go or
    98  # bootstrap, so we use golang-go (1.6) as bootstrap to build Go from source code.
    99  # We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
   100  # not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
   101  ENV GO_VERSION 1.8.3
   102  RUN mkdir /usr/src/go && curl -fsSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \
   103  	&& cd /usr/src/go/src \
   104  	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
   105  
   106  ENV PATH /go/bin:/usr/src/go/bin:$PATH
   107  ENV GOPATH /go
   108  
   109  # Dependency for golint
   110  ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
   111  RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
   112  	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT)
   113  
   114  # Grab Go's lint tool
   115  ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
   116  RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
   117  	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
   118  	&& go install -v github.com/golang/lint/golint
   119  
   120  # Only install one version of the registry, because old version which support
   121  # schema1 manifests is not working on ARM64, we should skip integration-cli
   122  # tests for schema1 manifests on ARM64.
   123  ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
   124  RUN set -x \
   125  	&& export GOPATH="$(mktemp -d)" \
   126  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   127  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   128  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   129  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   130  	&& rm -rf "$GOPATH"
   131  
   132  # Install notary and notary-server
   133  ENV NOTARY_VERSION v0.5.0
   134  RUN set -x \
   135  	&& export GOPATH="$(mktemp -d)" \
   136  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   137  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   138  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   139  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   140  	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
   141  		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
   142  	&& rm -rf "$GOPATH"
   143  
   144  # Get the "docker-py" source so we can run their integration tests
   145  ENV DOCKER_PY_COMMIT 4a08d04aef0595322e1b5ac7c52f28a931da85a5
   146  # Before running the integration tests conftest.py is
   147  # loaded which results in loads auth.py that
   148  # imports the docker-pycreds module.
   149  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   150  	&& cd /docker-py \
   151  	&& git checkout -q $DOCKER_PY_COMMIT \
   152  	&& pip install wheel \
   153  	&& pip install docker-pycreds==0.2.1 \
   154  	&& pip install -r test-requirements.txt
   155  
   156  # Install yamllint for validating swagger.yaml
   157  RUN pip install yamllint==1.5.0
   158  
   159  # Install go-swagger for validating swagger.yaml
   160  ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
   161  RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \
   162  	&& (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \
   163  	&& go install -v github.com/go-swagger/go-swagger/cmd/swagger
   164  
   165  # Set user.email so crosbymichael's in-container merge commits go smoothly
   166  RUN git config --global user.email 'docker-dummy@example.com'
   167  
   168  # Add an unprivileged user to be used for tests which need it
   169  RUN groupadd -r docker
   170  RUN useradd --create-home --gid docker unprivilegeduser
   171  
   172  VOLUME /var/lib/docker
   173  WORKDIR /go/src/github.com/docker/docker
   174  ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
   175  
   176  # Let us use a .bashrc file
   177  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   178  
   179  # Register Docker's bash completion.
   180  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   181  
   182  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   183  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   184  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   185  	aarch64/buildpack-deps:jessie@sha256:107f4a96837ed89c493fc205cd28508ed0b6b680b4bf3e514e9f0fa0f6667b77 \
   186  	aarch64/busybox:latest@sha256:5a06b8b2fdf22dd1f4085c6c3efd23ee99af01b2d668d286bc4be6d8baa10efb \
   187  	aarch64/debian:jessie@sha256:e6f90b568631705bd5cb27490977378ba762792b38d47c91c4da7a539f63079a \
   188  	aarch64/hello-world:latest@sha256:bd1722550b97668b23ede297abf824d4855f4d9f600dab7b4db1a963dae7ec9e
   189  # See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
   190  
   191  # Install tomlv, vndr, runc, containerd, tini, docker-proxy
   192  # Please edit hack/dockerfile/install-binaries.sh to update them.
   193  COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
   194  COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
   195  RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli
   196  ENV PATH=/usr/local/cli:$PATH
   197  
   198  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   199  ENTRYPOINT ["hack/dind"]
   200  
   201  # Upload docker source
   202  COPY . /go/src/github.com/docker/docker