From 25ceb6825741fb3ac6f9e535af4f3336301edbb0 Mon Sep 17 00:00:00 2001 From: Polina Bungina <27892524+hughcapet@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:30:35 +0200 Subject: [PATCH] Fix k8s dockerfiles (#2870) - Allow pip to modify an EXTERNALLY-MANAGED Python installation by passing --break-system-packages - Build Citus for arm64 - Don't use PG_MAJOR argument --- kubernetes/Dockerfile | 4 ++-- kubernetes/Dockerfile.citus | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/kubernetes/Dockerfile b/kubernetes/Dockerfile index 2fa25f73..29a683bd 100644 --- a/kubernetes/Dockerfile +++ b/kubernetes/Dockerfile @@ -9,8 +9,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \ | xargs apt-get install -y vim-tiny curl jq locales git python3-pip python3-wheel \ ## Make sure we have a en_US.UTF-8 locale available && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ - && pip3 install setuptools \ - && pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ + && pip3 install --break-system-packages setuptools \ + && pip3 install --break-system-packages 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ && PGHOME=/home/postgres \ && mkdir -p $PGHOME \ && chown postgres $PGHOME \ diff --git a/kubernetes/Dockerfile.citus b/kubernetes/Dockerfile.citus index 1ae242bf..f9564521 100644 --- a/kubernetes/Dockerfile.citus +++ b/kubernetes/Dockerfile.citus @@ -10,12 +10,24 @@ RUN export DEBIAN_FRONTEND=noninteractive \ | xargs apt-get install -y busybox vim-tiny curl jq less locales git python3-pip python3-wheel lsb-release \ ## Make sure we have a en_US.UTF-8 locale available && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ - && echo "deb [signed-by=/etc/apt/trusted.gpg.d/citusdata_community.gpg] https://packagecloud.io/citusdata/community/debian/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/citusdata_community.list \ - && curl -sL https://packagecloud.io/citusdata/community/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/citusdata_community.gpg \ - && apt-get update -y \ - && apt-get -y install postgresql-$PG_MAJOR-citus-11.3 \ - && pip3 install setuptools \ - && pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ + && if [ $(dpkg --print-architecture) = 'arm64' ]; then \ + apt-get install -y postgresql-server-dev-15 \ + gcc make autoconf \ + libc6-dev flex libcurl4-gnutls-dev \ + libicu-dev libkrb5-dev liblz4-dev \ + libpam0g-dev libreadline-dev libselinux1-dev\ + libssl-dev libxslt1-dev libzstd-dev uuid-dev \ + && git clone -b "main" https://github.com/citusdata/citus.git \ + && MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)" \ + && cd citus && ./configure && make install && cd ../ && rm -rf /citus; \ + else \ + echo "deb [signed-by=/etc/apt/trusted.gpg.d/citusdata_community.gpg] https://packagecloud.io/citusdata/community/debian/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/citusdata_community.list \ + && curl -sL https://packagecloud.io/citusdata/community/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/citusdata_community.gpg \ + && apt-get update -y \ + && apt-get -y install postgresql-15-citus-12.0; \ + fi \ + && pip3 install --break-system-packages setuptools \ + && pip3 install --break-system-packages 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \ && PGHOME=/home/postgres \ && mkdir -p $PGHOME \ && chown postgres $PGHOME \ @@ -26,6 +38,9 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && chmod 664 /etc/passwd \ # Clean up && apt-get remove -y git python3-pip python3-wheel \ + postgresql-server-dev-15 gcc make autoconf \ + libc6-dev flex libicu-dev libkrb5-dev liblz4-dev \ + libpam0g-dev libreadline-dev libselinux1-dev libssl-dev libxslt1-dev libzstd-dev uuid-dev \ && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* /root/.cache