|
| 1 | +FROM python:2.7-stretch |
| 2 | + |
| 3 | +# Version and other variables which can be changed. |
| 4 | +ENV GAIA_PORT=8080 \ |
| 5 | + GAIA_WORKER=2 \ |
| 6 | + GAIA_HOMEPATH=/data |
| 7 | + |
| 8 | +# CircleCI required tools |
| 9 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 10 | + git \ |
| 11 | + ssh \ |
| 12 | + tar \ |
| 13 | + gzip \ |
| 14 | + ca-certificates \ |
| 15 | + && rm -rf /var/lib/apt/lists/* |
| 16 | + |
| 17 | +# --------------- Start Go Part --------------- |
| 18 | +# gcc for cgo |
| 19 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 20 | +g++ \ |
| 21 | +gcc \ |
| 22 | +libc6-dev \ |
| 23 | +make \ |
| 24 | +pkg-config \ |
| 25 | +&& rm -rf /var/lib/apt/lists/* |
| 26 | + |
| 27 | +ENV GOLANG_VERSION 1.10.3 |
| 28 | + |
| 29 | +RUN set -eux; \ |
| 30 | +\ |
| 31 | +# this "case" statement is generated via "update.sh" |
| 32 | +dpkgArch="$(dpkg --print-architecture)"; \ |
| 33 | +case"${dpkgArch##*-}" in \ |
| 34 | +amd64) goRelArch='linux-amd64'; goRelSha256='fa1b0e45d3b647c252f51f5e1204aba049cde4af177ef9f2181f43004f901035' ;; \ |
| 35 | +armhf) goRelArch='linux-armv6l'; goRelSha256='d3df3fa3d153e81041af24f31a82f86a21cb7b92c1b5552fb621bad0320f06b6' ;; \ |
| 36 | +arm64) goRelArch='linux-arm64'; goRelSha256='355128a05b456c9e68792143801ad18e0431510a53857f640f7b30ba92624ed2' ;; \ |
| 37 | +i386) goRelArch='linux-386'; goRelSha256='3d5fe1932c904a01acb13dae07a5835bffafef38bef9e5a05450c52948ebdeb4' ;; \ |
| 38 | +ppc64el) goRelArch='linux-ppc64le'; goRelSha256='f3640b2f0990a9617c937775f669ee18f10a82e424e5f87a8ce794a6407b8347' ;; \ |
| 39 | +s390x) goRelArch='linux-s390x'; goRelSha256='34385f64651f82fbc11dc43bdc410c2abda237bdef87f3a430d35a508ec3ce0d' ;; \ |
| 40 | +*) goRelArch='src'; goRelSha256='567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2'; \ |
| 41 | +echo >&2; echo >&2"warning: current architecture ($dpkgArch) does not have a corresponding Go binary release; will be building from source"; echo >&2 ;; \ |
| 42 | +esac; \ |
| 43 | +\ |
| 44 | +url="https://golang.org/dl/go${GOLANG_VERSION}.${goRelArch}.tar.gz"; \ |
| 45 | +wget -O go.tgz"$url"; \ |
| 46 | +echo"${goRelSha256} *go.tgz" | sha256sum -c -; \ |
| 47 | +tar -C /usr/local -xzf go.tgz; \ |
| 48 | +rm go.tgz; \ |
| 49 | +\ |
| 50 | +if ["$goRelArch" ='src' ]; then \ |
| 51 | +echo >&2; \ |
| 52 | +echo >&2'error: UNIMPLEMENTED'; \ |
| 53 | +echo >&2'TODO install golang-any from jessie-backports for GOROOT_BOOTSTRAP (and uninstall after build)'; \ |
| 54 | +echo >&2; \ |
| 55 | +exit 1; \ |
| 56 | +fi; \ |
| 57 | +\ |
| 58 | +export PATH="/usr/local/go/bin:$PATH"; \ |
| 59 | +go version |
| 60 | + |
| 61 | +ENV GOPATH /go |
| 62 | +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH |
| 63 | + |
| 64 | +RUN mkdir -p"$GOPATH/src""$GOPATH/bin" && chmod -R 777"$GOPATH" |
| 65 | +# --------------- End Go Part --------------- |
| 66 | + |
| 67 | +# --------------- Start Java Part --------------- |
| 68 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 69 | +bzip2 \ |
| 70 | +unzip \ |
| 71 | +xz-utils \ |
| 72 | +&& rm -rf /var/lib/apt/lists/* |
| 73 | + |
| 74 | +# Default to UTF-8 file.encoding |
| 75 | +ENV LANG C.UTF-8 |
| 76 | + |
| 77 | +# add a simple script that can auto-detect the appropriate JAVA_HOME value |
| 78 | +# based on whether the JDK or only the JRE is installed |
| 79 | +RUN { \ |
| 80 | +echo'#!/bin/sh'; \ |
| 81 | +echo'set -e'; \ |
| 82 | +echo; \ |
| 83 | +echo'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ |
| 84 | +} > /usr/local/bin/docker-java-home \ |
| 85 | +&& chmod +x /usr/local/bin/docker-java-home |
| 86 | + |
| 87 | +# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe |
| 88 | +RUN ln -svT"/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)" /docker-java-home |
| 89 | +ENV JAVA_HOME /docker-java-home |
| 90 | + |
| 91 | +ENV JAVA_VERSION 8u181 |
| 92 | +ENV JAVA_DEBIAN_VERSION 8u181-b13-2~deb9u1 |
| 93 | + |
| 94 | +# see https://bugs.debian.org/775775 |
| 95 | +# and https://github.com/docker-library/java/issues/19#issuecomment-70546872 |
| 96 | +ENV CA_CERTIFICATES_JAVA_VERSION 20170531+nmu1 |
| 97 | + |
| 98 | +RUN set -ex; \ |
| 99 | +\ |
| 100 | +# deal with slim variants not having man page directories (which causes "update-alternatives" to fail) |
| 101 | +if [ ! -d /usr/share/man/man1 ]; then \ |
| 102 | +mkdir -p /usr/share/man/man1; \ |
| 103 | +fi; \ |
| 104 | +\ |
| 105 | +apt-get update; \ |
| 106 | +apt-get install -y --no-install-recommends \ |
| 107 | +openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \ |
| 108 | +ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \ |
| 109 | +; \ |
| 110 | +rm -rf /var/lib/apt/lists/*; \ |
| 111 | +\ |
| 112 | +# verify that "docker-java-home" returns what we expect |
| 113 | +["$(readlink -f "$JAVA_HOME")" ="$(docker-java-home)" ]; \ |
| 114 | +\ |
| 115 | +# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java |
| 116 | +update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")"'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ |
| 117 | +# ... and verify that it actually worked for one of the alternatives we care about |
| 118 | +update-alternatives --query java | grep -q'Status: manual' |
| 119 | + |
| 120 | +# see CA_CERTIFICATES_JAVA_VERSION notes above |
| 121 | +RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure |
| 122 | +# --------------- End Java Part --------------- |
| 123 | + |
| 124 | +# --------------- Start Maven Part --------------- |
| 125 | +ARG MAVEN_VERSION=3.5.4 |
| 126 | +ARG USER_HOME_DIR="/root" |
| 127 | +ARG SHA=ce50b1c91364cb77efe3776f756a6d92b76d9038b0a0782f7d53acf1e997a14d |
| 128 | +ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries |
| 129 | + |
| 130 | +RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ |
| 131 | + && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ |
| 132 | + && echo"${SHA} /tmp/apache-maven.tar.gz" | sha256sum -c - \ |
| 133 | + && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ |
| 134 | + && rm -f /tmp/apache-maven.tar.gz \ |
| 135 | + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn |
| 136 | + |
| 137 | +ENV MAVEN_HOME /usr/share/maven |
| 138 | +ENV MAVEN_CONFIG"$USER_HOME_DIR/.m2" |
| 139 | +# --------------- End Maven Part --------------- |
| 140 | + |
| 141 | +# --------------- Start C++ Part --------------- |
| 142 | +RUN apt-get update && apt-get install -y \ |
| 143 | + build-essential autoconf git pkg-config \ |
| 144 | + automake libtool curl make g++ unzip \ |
| 145 | + && apt-get clean |
| 146 | + |
| 147 | +# install protobuf first, then grpc |
| 148 | +ENV GRPC_RELEASE_TAG v1.16.x |
| 149 | +RUN git clone -b ${GRPC_RELEASE_TAG} https://github.com/grpc/grpc /var/local/git/grpc && \ |
| 150 | + cd /var/local/git/grpc && \ |
| 151 | + git submodule update --init && \ |
| 152 | + echo"--- installing protobuf ---" && \ |
| 153 | + cd third_party/protobuf && \ |
| 154 | + ./autogen.sh && ./configure --enable-shared && \ |
| 155 | + make -j$(nproc) && make install && make clean && ldconfig && \ |
| 156 | + echo"--- installing grpc ---" && \ |
| 157 | + cd /var/local/git/grpc && \ |
| 158 | + make -j$(nproc) && make install && make clean && ldconfig |
| 159 | +# --------------- Start C++ Part --------------- |
| 160 | + |
| 161 | +# install additional deps |
| 162 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 163 | +python2.7-dev \ |
| 164 | + git \ |
| 165 | +&& rm -rf /var/lib/apt/lists/* \ |
| 166 | + && pip install virtualenv grpcio |
| 167 | + |