github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/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  # # 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 aarch64/ubuntu:trusty
    27  
    28  # Packaged dependencies
    29  RUN apt-get update && apt-get install -y \
    30  	apparmor \
    31  	aufs-tools \
    32  	automake \
    33  	bash-completion \
    34  	btrfs-tools \
    35  	build-essential \
    36  	createrepo \
    37  	curl \
    38  	dpkg-sig \
    39  	g++ \
    40  	gcc \
    41  	git \
    42  	iptables \
    43  	jq \
    44  	libapparmor-dev \
    45  	libc6-dev \
    46  	libcap-dev \
    47  	libsqlite3-dev \
    48  	libsystemd-journal-dev \
    49  	mercurial \
    50  	parallel \
    51  	pkg-config \
    52  	python-dev \
    53  	python-mock \
    54  	python-pip \
    55  	python-websocket \
    56  	s3cmd=1.1.0* \
    57  	--no-install-recommends
    58  
    59  # Install armhf loader to use armv6 binaries on armv8
    60  RUN dpkg --add-architecture armhf \
    61  	&& apt-get update \
    62  	&& apt-get install -y libc6:armhf
    63  
    64  # Get lvm2 source for compiling statically
    65  ENV LVM2_VERSION 2.02.103
    66  RUN mkdir -p /usr/local/lvm2 \
    67  	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
    68  		| tar -xzC /usr/local/lvm2 --strip-components=1
    69  # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
    70  
    71  # fix platform enablement in lvm2 to support aarch64 properly
    72  RUN set -e \
    73  	&& for f in config.guess config.sub; do \
    74  		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
    75  	done
    76  # "arch.c:78:2: error: #error the arch code needs to know about your machine type"
    77  
    78  # Compile and install lvm2
    79  RUN cd /usr/local/lvm2 \
    80  	&& ./configure \
    81  		--build="$(gcc -print-multiarch)" \
    82  		--enable-static_link \
    83  	&& make device-mapper \
    84  	&& make install_device-mapper
    85  # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
    86  
    87  # Install Go
    88  # We don't have official binary tarballs for ARM64, eigher for Go or bootstrap,
    89  # so we use the official armv6 released binaries as a GOROOT_BOOTSTRAP, and
    90  # build Go from source code.
    91  ENV BOOT_STRAP_VERSION 1.6beta1
    92  ENV GO_VERSION 1.5.3
    93  RUN mkdir -p /usr/src/go-bootstrap \
    94  	&& curl -fsSL https://storage.googleapis.com/golang/go${BOOT_STRAP_VERSION}.linux-arm6.tar.gz | tar -v -C /usr/src/go-bootstrap -xz --strip-components=1 \
    95  	&& mkdir /usr/src/go \
    96  	&& curl -fsSL https://storage.googleapis.com/golang/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \
    97  	&& cd /usr/src/go/src \
    98  	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP=/usr/src/go-bootstrap ./make.bash
    99  ENV PATH /usr/src/go/bin:$PATH
   100  ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
   101  
   102  # Install registry
   103  ENV REGISTRY_COMMIT a7ae88da459b98b481a245e5b1750134724ac67d
   104  RUN set -x \
   105  	&& export GOPATH="$(mktemp -d)" \
   106  	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
   107  	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
   108  	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
   109  		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
   110  	&& rm -rf "$GOPATH"
   111  
   112  # Install notary server
   113  ENV NOTARY_VERSION docker-v1.10-5
   114  RUN set -x \
   115  	&& export GOPATH="$(mktemp -d)" \
   116  	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
   117  	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
   118  	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
   119  		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
   120  	&& rm -rf "$GOPATH"
   121  
   122  # Get the "docker-py" source so we can run their integration tests
   123  ENV DOCKER_PY_COMMIT 57512760c83fbe41302891aa51e34a86f4db74de
   124  RUN git clone https://github.com/docker/docker-py.git /docker-py \
   125  	&& cd /docker-py \
   126  	&& git checkout -q $DOCKER_PY_COMMIT \
   127  	&& pip install -r test-requirements.txt
   128  
   129  # Setup s3cmd config
   130  RUN { \
   131  		echo '[default]'; \
   132  		echo 'access_key=$AWS_ACCESS_KEY'; \
   133  		echo 'secret_key=$AWS_SECRET_KEY'; \
   134  	} > ~/.s3cfg
   135  
   136  # Set user.email so crosbymichael's in-container merge commits go smoothly
   137  RUN git config --global user.email 'docker-dummy@example.com'
   138  
   139  # Add an unprivileged user to be used for tests which need it
   140  RUN groupadd -r docker
   141  RUN useradd --create-home --gid docker unprivilegeduser
   142  
   143  VOLUME /var/lib/docker
   144  WORKDIR /go/src/github.com/docker/docker
   145  ENV DOCKER_BUILDTAGS apparmor selinux
   146  
   147  # Let us use a .bashrc file
   148  RUN ln -sfv $PWD/.bashrc ~/.bashrc
   149  
   150  # Register Docker's bash completion.
   151  RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
   152  
   153  # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
   154  COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
   155  RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
   156  	aarch64/busybox:latest@sha256:b23a6a37cf269dff6e46d2473b6e227afa42b037e6d23435f1d2bc40fc8c2828 \
   157  	aarch64/debian:jessie@sha256:4be74a41a7c70ebe887b634b11ffe516cf4fcd56864a54941e56bb49883c3170 \
   158  	aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda
   159  # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
   160  
   161  # Download man page generator
   162  RUN set -x \
   163  	&& export GOPATH="$(mktemp -d)" \
   164  	&& git clone -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
   165  	&& git clone -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
   166  	&& go get -v -d github.com/cpuguy83/go-md2man \
   167  	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
   168  	&& rm -rf "$GOPATH"
   169  
   170  # Download toml validator
   171  ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
   172  RUN set -x \
   173  	&& export GOPATH="$(mktemp -d)" \
   174  	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
   175  	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
   176  	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
   177  	&& rm -rf "$GOPATH"
   178  
   179  # Wrap all commands in the "docker-in-docker" script to allow nested containers
   180  ENTRYPOINT ["hack/dind"]
   181  
   182  # Upload docker source
   183  COPY . /go/src/github.com/docker/docker