diff --git a/tests/docker/Dockerfile-step-1.el9 b/tests/docker/Dockerfile-step-1.el9 index 5a9b4bc5..8511747c 100644 --- a/tests/docker/Dockerfile-step-1.el9 +++ b/tests/docker/Dockerfile-step-1.el9 @@ -1,13 +1,17 @@ FROM ghcr.io/pgedge/base-test-image:latest ARG PGVER +ARG MAKE_JOBS=4 ENV PGVER=$PGVER +ENV PATH="/home/pgedge/pgedge/pg${PGVER}/bin:${PATH}" +ENV LD_LIBRARY_PATH="/home/pgedge/pgedge/pg${PGVER}/lib:${LD_LIBRARY_PATH}" +ENV PG_CONFIG="/home/pgedge/pgedge/pg${PGVER}/bin/pg_config" COPY . /home/pgedge/spock WORKDIR /home/pgedge -RUN echo "Determine PostgreSQL tag" +# Determine PostgreSQL version and clone repository RUN LATEST_TAG=$(git ls-remote --tags https://github.com/postgres/postgres.git | \ grep "refs/tags/REL_${PGVER}_" | \ sed 's|.*refs/tags/||' | \ @@ -15,16 +19,14 @@ RUN LATEST_TAG=$(git ls-remote --tags https://github.com/postgres/postgres.git | sort -V | \ tail -n 1 | \ tr '.' '_') && \ - echo "Using tag $LATEST_TAG" && \ - git clone --branch $LATEST_TAG --depth 1 https://github.com/postgres/postgres /home/pgedge/postgres + echo "Using PostgreSQL tag: $LATEST_TAG" && \ + git clone --branch $LATEST_TAG --depth 1 https://github.com/postgres/postgres /home/pgedge/postgres && \ + chmod -R a+w /home/pgedge/postgres - -RUN sudo chmod -R a+w ~/postgres - -RUN echo "Setting up pgedge..." -WORKDIR /home/pgedge -RUN curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py > /home/pgedge/install.py -RUN sudo -u pgedge python3 /home/pgedge/install.py +# Install pgedge +RUN echo "Setting up pgedge..." && \ + curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py -o /home/pgedge/install.py && \ + sudo -u pgedge python3 /home/pgedge/install.py WORKDIR /home/pgedge/postgres @@ -32,23 +34,46 @@ RUN for patchfile in /home/pgedge/spock/patches/${PGVER}/*; do \ patch -p1 --verbose < $patchfile; \ done -RUN echo "==========Compiling Modified PostgreSQL==========" -RUN options="'--prefix=/home/pgedge/pgedge/pg$PGVER' '--disable-rpath' '--with-zstd' '--with-lz4' '--with-icu' '--with-libxslt' '--with-libxml' '--with-uuid=ossp' '--with-gssapi' '--with-ldap' '--with-pam' '--enable-debug' '--enable-dtrace' '--with-llvm' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' '--enable-cassert' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make -C contrib -j4 && make install && make -C contrib install - -WORKDIR /home/pgedge - -RUN echo "export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg$PGVER/lib/:$LD_LIBRARY_PATH" >> /home/pgedge/.bashrc -RUN echo "export PATH=/home/pgedge/pgedge/pg$PGVER/bin:$PATH" >> /home/pgedge/.bashrc - -RUN echo "==========Recompiling Spock==========" +# Compile PostgreSQL +RUN echo "==========Compiling Modified PostgreSQL==========" && \ + ./configure \ + --prefix="/home/pgedge/pgedge/pg${PGVER}" \ + --disable-rpath \ + --with-zstd \ + --with-lz4 \ + --with-icu \ + --with-libxslt \ + --with-libxml \ + --with-uuid=ossp \ + --with-gssapi \ + --with-ldap \ + --with-pam \ + --enable-debug \ + --enable-dtrace \ + --with-llvm \ + --with-openssl \ + --with-systemd \ + --enable-tap-tests \ + --with-python \ + --enable-cassert \ + PYTHON=/usr/bin/python3.9 \ + BITCODE_CFLAGS="-gdwarf-5 -O0 -fforce-dwarf-frame" \ + CFLAGS="-g -O0" && \ + make -j${MAKE_JOBS} && \ + make -C contrib -j${MAKE_JOBS} && \ + make install && \ + make -C contrib install + +# Compile Spock WORKDIR /home/pgedge/spock -RUN . /home/pgedge/.bashrc && export PG_CONFIG=/home/pgedge/pgedge/pg$PGVER/bin/pg_config && export PATH=/home/pgedge/pgedge/pg$PGVER/bin:$PATH && make clean && make -j16 && make install - -RUN echo "==========Built Spock==========" +RUN echo "==========Compiling Spock==========" && \ + make clean && \ + make -j${MAKE_JOBS} && \ + make install && \ + echo "==========Spock build complete==========" #----------------------------------------- -COPY tests/docker/*.sh /home/pgedge/ -RUN sudo chmod +x /home/pgedge/*.sh +COPY --chmod=755 tests/docker/*.sh /home/pgedge/ WORKDIR /home/pgedge/ USER pgedge