github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/Dockerfile (about) 1 # This file describes the standard way to build Docker, using docker 2 # 3 # Usage: 4 # 5 # # Assemble the full dev environment. This is slow the first time. 6 # docker build -t docker . 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 # # 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 debian:jessie 27 28 # allow replacing httpredir or deb mirror 29 ARG APT_MIRROR=deb.debian.org 30 RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list 31 32 # Add zfs ppa 33 RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 \ 34 || apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61 35 RUN echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list 36 37 # Packaged dependencies 38 RUN apt-get update && apt-get install -y \ 39 apparmor \ 40 apt-utils \ 41 aufs-tools \ 42 automake \ 43 bash-completion \ 44 binutils-mingw-w64 \ 45 bsdmainutils \ 46 btrfs-tools \ 47 build-essential \ 48 clang \ 49 cmake \ 50 createrepo \ 51 curl \ 52 dpkg-sig \ 53 gcc-mingw-w64 \ 54 git \ 55 iptables \ 56 jq \ 57 less \ 58 libapparmor-dev \ 59 libcap-dev \ 60 libltdl-dev \ 61 libnl-3-dev \ 62 libprotobuf-c0-dev \ 63 libprotobuf-dev \ 64 libsqlite3-dev \ 65 libsystemd-journal-dev \ 66 libtool \ 67 libzfs-dev \ 68 mercurial \ 69 net-tools \ 70 pkg-config \ 71 protobuf-compiler \ 72 protobuf-c-compiler \ 73 python-dev \ 74 python-mock \ 75 python-pip \ 76 python-websocket \ 77 tar \ 78 ubuntu-zfs \ 79 vim \ 80 vim-common \ 81 xfsprogs \ 82 zip \ 83 --no-install-recommends \ 84 && pip install awscli==1.10.15 85 # Get lvm2 source for compiling statically 86 ENV LVM2_VERSION 2.02.103 87 RUN mkdir -p /usr/local/lvm2 \ 88 && curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \ 89 | tar -xzC /usr/local/lvm2 --strip-components=1 90 # See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags 91 92 # Compile and install lvm2 93 RUN cd /usr/local/lvm2 \ 94 && ./configure \ 95 --build="$(gcc -print-multiarch)" \ 96 --enable-static_link \ 97 && make device-mapper \ 98 && make install_device-mapper 99 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL 100 101 # Configure the container for OSX cross compilation 102 ENV OSX_SDK MacOSX10.11.sdk 103 ENV OSX_CROSS_COMMIT a9317c18a3a457ca0a657f08cc4d0d43c6cf8953 104 RUN set -x \ 105 && export OSXCROSS_PATH="/osxcross" \ 106 && git clone https://github.com/tpoechtrager/osxcross.git $OSXCROSS_PATH \ 107 && ( cd $OSXCROSS_PATH && git checkout -q $OSX_CROSS_COMMIT) \ 108 && curl -sSL https://s3.dockerproject.org/darwin/v2/${OSX_SDK}.tar.xz -o "${OSXCROSS_PATH}/tarballs/${OSX_SDK}.tar.xz" \ 109 && UNATTENDED=yes OSX_VERSION_MIN=10.6 ${OSXCROSS_PATH}/build.sh 110 ENV PATH /osxcross/target/bin:$PATH 111 112 # Install seccomp: the version shipped in trusty is too old 113 ENV SECCOMP_VERSION 2.3.1 114 RUN set -x \ 115 && export SECCOMP_PATH="$(mktemp -d)" \ 116 && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \ 117 | tar -xzC "$SECCOMP_PATH" --strip-components=1 \ 118 && ( \ 119 cd "$SECCOMP_PATH" \ 120 && ./configure --prefix=/usr/local \ 121 && make \ 122 && make install \ 123 && ldconfig \ 124 ) \ 125 && rm -rf "$SECCOMP_PATH" 126 127 # Install Go 128 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines 129 # will need updating, to avoid errors. Ping #docker-maintainers on IRC 130 # with a heads-up. 131 132 133 ENV GO_VERSION 1.7.3 134 #RUN apt-get install -y wget && wget http://www.golangtc.com/static/go/1.7.3/go${GO_VERSIOn}.linux-amd64.tar.gz \ 135 # | tar -xzC /usr/local 136 COPY go1.7.3.linux-amd64.tar.gz . 137 RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local 138 139 140 ENV PATH /go/bin:/usr/local/go/bin:$PATH 141 ENV GOPATH /go 142 143 # Compile Go for cross compilation 144 ENV DOCKER_CROSSPLATFORMS \ 145 linux/386 linux/arm \ 146 darwin/amd64 \ 147 freebsd/amd64 freebsd/386 freebsd/arm \ 148 windows/amd64 windows/386 \ 149 solaris/amd64 150 151 # Dependency for golint 152 ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 153 RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \ 154 && (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) 155 156 # Grab Go's lint tool 157 ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456 158 RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \ 159 && (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \ 160 && go install -v github.com/golang/lint/golint 161 162 # Install CRIU for checkpoint/restore support 163 ENV CRIU_VERSION 2.2 164 RUN mkdir -p /usr/src/criu \ 165 && curl -sSL https://github.com/xemul/criu/archive/v${CRIU_VERSION}.tar.gz | tar -v -C /usr/src/criu/ -xz --strip-components=1 \ 166 && cd /usr/src/criu \ 167 && make \ 168 && make install-criu 169 170 # Install two versions of the registry. The first is an older version that 171 # only supports schema1 manifests. The second is a newer version that supports 172 # both. This allows integration-cli tests to cover push/pull with both schema1 173 # and schema2 manifests. 174 ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd 175 ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 176 RUN set -x \ 177 && export GOPATH="$(mktemp -d)" \ 178 && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \ 179 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ 180 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 181 go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \ 182 && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1") \ 183 && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ 184 go build -o /usr/local/bin/registry-v2-schema1 github.com/docker/distribution/cmd/registry \ 185 && rm -rf "$GOPATH" 186 187 # Install notary and notary-server 188 ENV NOTARY_VERSION v0.4.2 189 RUN set -x \ 190 && export GOPATH="$(mktemp -d)" \ 191 && git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \ 192 && (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \ 193 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 194 go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \ 195 && GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \ 196 go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \ 197 && rm -rf "$GOPATH" 198 199 # Get the "docker-py" source so we can run their integration tests 200 ENV DOCKER_PY_COMMIT e2655f658408f9ad1f62abdef3eb6ed43c0cf324 201 RUN git clone https://github.com/docker/docker-py.git /docker-py \ 202 && cd /docker-py \ 203 && git checkout -q $DOCKER_PY_COMMIT \ 204 && pip install -r test-requirements.txt 205 206 # Install yamllint for validating swagger.yaml 207 RUN pip install yamllint==1.5.0 208 209 # Install go-swagger for validating swagger.yaml 210 ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb 211 RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ 212 && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ 213 && go install -v github.com/go-swagger/go-swagger/cmd/swagger 214 215 # Set user.email so crosbymichael's in-container merge commits go smoothly 216 RUN git config --global user.email 'docker-dummy@example.com' 217 218 # Add an unprivileged user to be used for tests which need it 219 RUN groupadd -r docker 220 RUN useradd --create-home --gid docker unprivilegeduser 221 222 VOLUME /var/lib/docker 223 WORKDIR /go/src/github.com/docker/docker 224 ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux 225 226 # Let us use a .bashrc file 227 RUN ln -sfv $PWD/.bashrc ~/.bashrc 228 # Add integration helps to bashrc 229 RUN echo "source $PWD/hack/make/.integration-test-helpers" >> /etc/bash.bashrc 230 231 # Register Docker's bash completion. 232 RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker 233 234 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling 235 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/ 236 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ 237 buildpack-deps:jessie@sha256:25785f89240fbcdd8a74bdaf30dd5599a9523882c6dfc567f2e9ef7cf6f79db6 \ 238 busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \ 239 debian:jessie@sha256:f968f10b4b523737e253a97eac59b0d1420b5c19b69928d35801a6373ffe330e \ 240 hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 241 # See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) 242 243 # Install tomlv, vndr, runc, containerd, tini, docker-proxy 244 # Please edit hack/dockerfile/install-binaries.sh to update them. 245 COPY hack/dockerfile/binaries-commits /tmp/binaries-commits 246 COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh 247 COPY mergeCode/containerd /tmp/containerd/ 248 COPY mergeCode/runc /tmp/runc/ 249 #COPY mergeCode/runc /tmp/toml/ 250 #COPY mergeCode/runc /tmp/vndr/ 251 #COPY mergeCode/runc /tmp/tini/ 252 #COPY mergeCode/runc /tmp/libnetwork/ 253 RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy 254 255 # Wrap all commands in the "docker-in-docker" script to allow nested containers 256 ENTRYPOINT ["hack/dind"] 257 258 # Upload docker source 259 COPY . /go/src/github.com/docker/docker