fix compile error
[platform/upstream/docker-engine.git] / Dockerfile.ppc64le
1 # This file describes the standard way to build Docker on ppc64le, 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.ppc64le .
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 ppc64le/debian:jessie
19
20 # allow replacing httpredir or deb mirror
21 ARG APT_MIRROR=deb.debian.org
22 RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
23
24 # Packaged dependencies
25 RUN apt-get update && apt-get install -y \
26         apparmor \
27         apt-utils \
28         aufs-tools \
29         automake \
30         bash-completion \
31         btrfs-tools \
32         build-essential \
33         cmake \
34         createrepo \
35         curl \
36         dpkg-sig \
37         git \
38         iptables \
39         jq \
40         net-tools \
41         libapparmor-dev \
42         libcap-dev \
43         libsystemd-journal-dev \
44         libtool \
45         mercurial \
46         pkg-config \
47         python-dev \
48         python-mock \
49         python-pip \
50         python-websocket \
51         xfsprogs \
52         tar \
53         vim-common \
54         --no-install-recommends
55
56 # Get lvm2 source for compiling statically
57 ENV LVM2_VERSION 2.02.103
58 RUN mkdir -p /usr/local/lvm2 \
59         && curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
60                 | tar -xzC /usr/local/lvm2 --strip-components=1
61 # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
62
63 # Fix platform enablement in lvm2 to support ppc64le properly
64 RUN set -e \
65         && for f in config.guess config.sub; do \
66                 curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
67         done
68 # "arch.c:78:2: error: #error the arch code needs to know about your machine type"
69
70 # Compile and install lvm2
71 RUN cd /usr/local/lvm2 \
72         && ./configure \
73                 --build="$(gcc -print-multiarch)" \
74                 --enable-static_link \
75         && make device-mapper \
76         && make install_device-mapper
77 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
78
79 # Install seccomp: the version shipped upstream is too old
80 ENV SECCOMP_VERSION 2.3.2
81 RUN set -x \
82         && export SECCOMP_PATH="$(mktemp -d)" \
83         && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
84                 | tar -xzC "$SECCOMP_PATH" --strip-components=1 \
85         && ( \
86                 cd "$SECCOMP_PATH" \
87                 && ./configure --prefix=/usr/local \
88                 && make \
89                 && make install \
90                 && ldconfig \
91         ) \
92         && rm -rf "$SECCOMP_PATH"
93
94
95 # Install Go
96 # NOTE: official ppc64le go binaries weren't available until go 1.6.4 and 1.7.4
97 ENV GO_VERSION 1.8.3
98 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" \
99         | tar -xzC /usr/local
100
101 ENV PATH /go/bin:/usr/local/go/bin:$PATH
102 ENV GOPATH /go
103
104 # Dependency for golint
105 ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
106 RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
107         && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT)
108
109 # Grab Go's lint tool
110 ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
111 RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
112         && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
113         && go install -v github.com/golang/lint/golint
114
115 # Install two versions of the registry. The first is an older version that
116 # only supports schema1 manifests. The second is a newer version that supports
117 # both. This allows integration-cli tests to cover push/pull with both schema1
118 # and schema2 manifests.
119 ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd
120 ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
121 RUN set -x \
122         && export GOPATH="$(mktemp -d)" \
123         && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
124         && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
125         && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
126                 go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
127         && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \
128         && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
129                 go build -o /usr/local/bin/registry-v2-schema1 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 a962578e515185cf06506050b2200c0b81aa84ef
146 RUN git clone https://github.com/docker/docker-py.git /docker-py \
147         && cd /docker-py \
148         && git checkout -q $DOCKER_PY_COMMIT \
149         && pip install -r test-requirements.txt
150
151 # Set user.email so crosbymichael's in-container merge commits go smoothly
152 RUN git config --global user.email 'docker-dummy@example.com'
153
154 # Add an unprivileged user to be used for tests which need it
155 RUN groupadd -r docker
156 RUN useradd --create-home --gid docker unprivilegeduser
157
158 VOLUME /var/lib/docker
159 WORKDIR /go/src/github.com/docker/docker
160 ENV DOCKER_BUILDTAGS apparmor seccomp selinux
161
162 # Let us use a .bashrc file
163 RUN ln -sfv $PWD/.bashrc ~/.bashrc
164
165 # Register Docker's bash completion.
166 RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
167
168 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
169 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
170 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
171         ppc64le/buildpack-deps:jessie@sha256:1a2f2d2cc8738f14b336aeffc3503b5c9dedf9e1f26c7313cb4999534ad4716f \
172         ppc64le/busybox:latest@sha256:54f34c83adfab20cf0e630d879e210f07b0062cd6caaf16346a61396d50e7584 \
173         ppc64le/debian:jessie@sha256:ea8c5b105e3790f075145b40e4be1e4488c9f33f55e6cc45182047b80a68f892 \
174         ppc64le/hello-world:latest@sha256:7d57adf137665f748956c86089320710b66d08584db3500ed98f4bb3da637c2d
175 # See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
176
177 # Install tomlv, vndr, runc, containerd, tini, docker-proxy
178 # Please edit hack/dockerfile/install-binaries.sh to update them.
179 COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
180 COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
181 RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli
182 ENV PATH=/usr/local/cli:$PATH
183
184 # Wrap all commands in the "docker-in-docker" script to allow nested containers
185 ENTRYPOINT ["hack/dind"]
186
187 # Upload docker source
188 COPY . /go/src/github.com/docker/docker