1# This file describes the standard way to build Docker on ARMv7, 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.armhf .
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 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
18FROM arm32v7/debian:stretch
19
20# allow replacing httpredir or deb mirror
21ARG APT_MIRROR=deb.debian.org
22RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
23
24# Packaged dependencies
25RUN apt-get update && apt-get install -y \
26	apparmor \
27	aufs-tools \
28	automake \
29	bash-completion \
30	btrfs-tools \
31	build-essential \
32	createrepo \
33	curl \
34	cmake \
35	dpkg-sig \
36	git \
37	iptables \
38	jq \
39	net-tools \
40	libapparmor-dev \
41	libcap-dev \
42	libdevmapper-dev \
43	libseccomp-dev \
44	libsystemd-dev \
45	libtool \
46	libudev-dev \
47	mercurial \
48	pkg-config \
49	python-backports.ssl-match-hostname \
50	python-dev \
51	python-mock \
52	python-pip \
53	python-requests \
54	python-setuptools \
55	python-websocket \
56	python-wheel \
57	xfsprogs \
58	tar \
59	thin-provisioning-tools \
60	vim-common \
61	--no-install-recommends \
62	&& pip install awscli==1.10.15
63
64# Install Go
65# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
66ENV GO_VERSION 1.9.2
67RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" \
68	| tar -xzC /usr/local
69ENV PATH /go/bin:/usr/local/go/bin:$PATH
70ENV GOPATH /go
71
72# We're building for armhf, which is ARMv7, so let's be explicit about that
73ENV GOARCH arm
74ENV GOARM 7
75
76# Install two versions of the registry. The first is an older version that
77# only supports schema1 manifests. The second is a newer version that supports
78# both. This allows integration-cli tests to cover push/pull with both schema1
79# and schema2 manifests.
80ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
81ENV REGISTRY_COMMIT cb08de17d74bef86ce6c5abe8b240e282f5750be
82RUN set -x \
83	&& export GOPATH="$(mktemp -d)" \
84	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
85	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
86	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
87		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
88	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
89	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
90		go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \
91	&& rm -rf "$GOPATH"
92
93# Install notary and notary-server
94ENV NOTARY_VERSION v0.5.0
95RUN set -x \
96	&& export GOPATH="$(mktemp -d)" \
97	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
98	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
99	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
100		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
101	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
102		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
103	&& rm -rf "$GOPATH"
104
105# Get the "docker-py" source so we can run their integration tests
106ENV DOCKER_PY_COMMIT 1d6b5b203222ba5df7dedfcd1ee061a452f99c8a
107# To run integration tests docker-pycreds is required.
108RUN git clone https://github.com/docker/docker-py.git /docker-py \
109	&& cd /docker-py \
110	&& git checkout -q $DOCKER_PY_COMMIT \
111	&& pip install docker-pycreds==0.2.1 \
112	&& pip install -r test-requirements.txt
113
114# Set user.email so crosbymichael's in-container merge commits go smoothly
115RUN git config --global user.email 'docker-dummy@example.com'
116
117# Add an unprivileged user to be used for tests which need it
118RUN groupadd -r docker
119RUN useradd --create-home --gid docker unprivilegeduser
120
121VOLUME /var/lib/docker
122WORKDIR /go/src/github.com/docker/docker
123ENV DOCKER_BUILDTAGS apparmor seccomp selinux
124
125# Let us use a .bashrc file
126RUN ln -sfv $PWD/.bashrc ~/.bashrc
127
128# Register Docker's bash completion.
129RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
130
131# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
132COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
133RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
134	armhf/buildpack-deps:jessie@sha256:eb2dad77ef53e88d94c3c83862d315c806ea1ca49b6e74f4db362381365ce489 \
135	armhf/busybox:latest@sha256:016a1e149d2acc2a3789a160dfa60ce870794eea27ad5e96f7a101970e5e1689 \
136	armhf/debian:jessie@sha256:ac59fa18b28d0ef751eabb5ba4c4b5a9063f99398bae2f70495aa8ed6139b577 \
137	armhf/hello-world:latest@sha256:9701edc932223a66e49dd6c894a11db8c2cf4eccd1414f1ec105a623bf16b426
138# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
139
140# Install tomlv, vndr, runc, containerd, tini, docker-proxy
141# Please edit hack/dockerfile/install-binaries.sh to update them.
142COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
143COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
144RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter
145ENV PATH=/usr/local/cli:$PATH
146
147ENTRYPOINT ["hack/dind"]
148
149# Options for hack/validate/gometalinter
150ENV GOMETALINTER_OPTS="--deadline 10m -j2"
151
152# Upload docker source
153COPY . /go/src/github.com/docker/docker
154