|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | +# you may not use this file except in compliance with the License. |
| 3 | +# You may obtain a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +# See the License for the specific language governing permissions and |
| 11 | +# limitations under the License. |
| 12 | + |
| 13 | +ARG DEPENDENCY_IMAGE=presto/prestissimo-dependency:centos9 |
| 14 | +ARG BASE_IMAGE=quay.io/centos/centos:stream9 |
| 15 | +FROM ${DEPENDENCY_IMAGE} as prestissimo-dev |
| 16 | + |
| 17 | +ARG OSNAME=centos |
| 18 | +ARG EXTRA_CMAKE_FLAGS='' |
| 19 | +ARG NUM_THREADS=8 |
| 20 | + |
| 21 | +ENV PROMPT_ALWAYS_RESPOND=n |
| 22 | +ENV BUILD_BASE_DIR=_build |
| 23 | +ENV LANG=C.UTF-8 |
| 24 | +ENV EXTRA_CMAKE_FLAGS=${EXTRA_CMAKE_FLAGS} |
| 25 | +ENV BUILD_ROOT=/presto |
| 26 | +ENV PRESTISSIMO_HOME=/opt/presitissimo |
| 27 | + |
| 28 | +RUN --mount=type=bind,source=.,target=${BUILD_ROOT},readonly=false \ |
| 29 | + --mount=type=cache,target=/root/ccache-${OSNAME} \ |
| 30 | + echo "[safe]" > /root/.gitconfig && \ |
| 31 | + echo " directory = ${BUILD_ROOT}" >> /root/.gitconfig && \ |
| 32 | + echo " directory = ${BUILD_ROOT}/presto-native-execution/velox" >> /root/.gitconfig && \ |
| 33 | + cat /root/.gitconfig && \ |
| 34 | + export CCACHE_DIR=/root/ccache-${OSNAME} && \ |
| 35 | + cd ${BUILD_ROOT}/presto-native-execution && \ |
| 36 | + make debug && df -h && \ |
| 37 | + make clean && \ |
| 38 | + make release && df -h && \ |
| 39 | + # EXTRA_CMAKE_FLAGS=${EXTRA_CMAKE_FLAGS} NUM_THREADS=${NUM_THREADS} \ |
| 40 | + # make --directory="${BUILD_ROOT}/presto-native-execution" cmake-and-build BUILD_TYPE=Release BUILD_DIR=release BUILD_BASE_DIR=${BUILD_BASE_DIR} && \ |
| 41 | + # EXTRA_CMAKE_FLAGS=${EXTRA_CMAKE_FLAGS} NUM_THREADS=${NUM_THREADS} \ |
| 42 | + # make --directory="${BUILD_ROOT}/presto-native-execution" cmake-and-build BUILD_TYPE=Debug BUILD_DIR=debug BUILD_BASE_DIR=${BUILD_BASE_DIR} && \ |
| 43 | + mkdir -p ${PRESTISSIMO_HOME}/{bin,lib} && \ |
| 44 | + !(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd /prestissimo/${BUILD_BASE_DIR}/release/presto_cpp/main/presto_server | grep "not found") && \ |
| 45 | + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd /prestissimo/${BUILD_BASE_DIR}/release/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " ${PRESTISSIMO_HOME}/lib") }' && \ |
| 46 | + cp ${BUILD_ROOT}/${BUILD_BASE_DIR}/release/presto_cpp/main/presto_server ${PRESTISSIMO_HOME}/bin && \ |
| 47 | + chmod 0755 ${PRESTISSIMO_HOME}/bin/presto_server && \ |
| 48 | + echo "${PRESTISSIMO_HOME}/lib" > /etc/ld.so.conf.d/prestissimo.conf && ldconfig && \ |
| 49 | + make clean && \ |
| 50 | + cd /root && cp -r ${CCACHE_DIR} .ccache && \ |
| 51 | + ccache -sz -v && \ |
| 52 | + |
| 53 | +COPY --chmod=0755 presto-native-execution/etc ${PRESTISSIMO_HOME}}/etc |
| 54 | +COPY --chmod=0775 presto-native-execution/entrypoint.sh ${PRESTISSIMO_HOME}/entrypoint.sh |
| 55 | + |
| 56 | +FROM prestissimo-dev AS centos-dev |
| 57 | + |
| 58 | +ENV PYTHON_VERSION=3.11.9 \ |
| 59 | + JAVA_HOME=/usr/lib/jvm/jre-11-openjdk |
| 60 | + |
| 61 | +RUN --mount=type=cache,target=/var/cache/dnf,sharing=locked \ |
| 62 | + --mount=type=cache,target=/usr/local/src,sharing=locked \ |
| 63 | + dnf update -y && dnf install -y java-11-openjdk-headless less procps wget diffutils git vim && \ |
| 64 | + cd /usr/local/src && \ |
| 65 | + wget -c https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \ |
| 66 | + tar xvf Python-${PYTHON_VERSION}.tgz && \ |
| 67 | + cd Python-${PYTHON_VERSION} && \ |
| 68 | + ./configure --enable-optimizations && \ |
| 69 | + make -j$(nproc) && \ |
| 70 | + make altinstall && \ |
| 71 | + alternatives --install /usr/bin/python python /usr/local/bin/python3.11 1 && \ |
| 72 | + alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 1 && \ |
| 73 | + rm -rf Python-${PYTHON_VERSION} |
| 74 | + |
| 75 | +RUN --mount=type=cache,target=/usr/local/src/.m2 \ |
| 76 | + --mount=type=bind,source=..,target=${BUILD_ROOT},readonly=false \ |
| 77 | + find /usr/local/src/.m2 || true && \ |
| 78 | + cd /presto && \ |
| 79 | + MAVEN_USER_HOME=/usr/local/src/.m2 ./mvnw clean install -Dmaven.repo.local=/usr/local/src/.m2/repository -DskipTests && \ |
| 80 | + for dir in presto-*; do \ |
| 81 | + rm -rf /usr/local/src/.m2/repository/com/facebook/presto/$dir; \ |
| 82 | + done && \ |
| 83 | + cp -a /usr/local/src/.m2 /root/ |
| 84 | + |
| 85 | +FROM prestissimo-dev AS ubuntu-dev |
| 86 | + |
| 87 | +ENV PRESTO_HOME=/opt/presto \ |
| 88 | + JMX_PROMETHEUS_JAVAAGENT_VERSION=0.20.0 |
| 89 | + |
| 90 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 91 | + --mount=type=cache,target=/usr/local/src,sharing=locked \ |
| 92 | + apt-get update && \ |
| 93 | + DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common wget less procps git vim diffutils curl xz-utils openjdk-11-jre-headless && \ |
| 94 | + add-apt-repository ppa:deadsnakes/ppa && \ |
| 95 | + apt-get update && \ |
| 96 | + DEBIAN_FRONTEND=noninteractive apt-get install -y python3.11 python3.11-venv python3.11-distutils && \ |
| 97 | + update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \ |
| 98 | + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 |
| 99 | + |
| 100 | +RUN --mount=type=cache,target=/root/m2 \ |
| 101 | + --mount=type=bind,source=..,target=${BUILD_ROOT},readonly=false \ |
| 102 | + cd ${BUILD_ROOT} && \ |
| 103 | + MAVEN_USER_HOME=/root/m2 ./mvnw clean install -Dmaven.repo.local=/root/.m2/repository -DskipTests && \ |
| 104 | + for dir in presto-*; do \ |
| 105 | + rm -rf /usr/local/src/.m2/repository/com/facebook/presto/$dir; \ |
| 106 | + done && \ |
| 107 | + cp -a /root/m2 /root/.m2 && \ |
| 108 | + mkdir -p $PRESTO_HOME && \ |
| 109 | + tar --strip-components=1 -C "$PRESTO_HOME" -zxf /$BUILD_ROOT/presto-server/target/presto-server-*.tar.gz \ |
| 110 | + && cp ${BUILD_ROOT}/presto-cli/target/presto-cli-*-executable.jar /opt/presto-cli \ |
| 111 | + && chmod 0755 /opt/presto-cli \ |
| 112 | + && ln -s /opt/presto-cli /usr/local/bin/ \ |
| 113 | + # mkdir for config |
| 114 | + && mkdir -p $PRESTO_HOME/etc/catalog \ |
| 115 | + && mkdir -p /var/lib/presto/data \ |
| 116 | + && mkdir -p /usr/lib/presto/utils \ |
| 117 | + && curl -o /usr/lib/presto/utils/jmx_prometheus_javaagent-$JMX_PROMETHEUS_JAVAAGENT_VERSION.jar https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/$JMX_PROMETHEUS_JAVAAGENT_VERSION/jmx_prometheus_javaagent-$JMX_PROMETHEUS_JAVAAGENT_VERSION.jar \ |
| 118 | + && ln -s /usr/lib/presto/utils/jmx_prometheus_javaagent-$JMX_PROMETHEUS_JAVAAGENT_VERSION.jar /usr/lib/presto/utils/jmx_prometheus_javaagent.jar |
| 119 | + |
| 120 | +COPY docker/etc/config.properties.example $PRESTO_HOME/etc/config.properties |
| 121 | +COPY docker/etc/jvm.config.example $PRESTO_HOME/etc/jvm.config |
| 122 | +COPY docker/etc/node.properties $PRESTO_HOME/etc/node.properties |
| 123 | +COPY docker/etc/catalog $PRESTO_HOME/etc/catalog |
| 124 | +COPY docker/entrypoint.sh $PRESTO_HOME/ |
0 commit comments