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