11FROM rockylinux:9
22
33ARG PGVER
4+ ARG GITHUB_REF
5+ ARG REPO_URL
46
57ENV PGVER=$PGVER
8+ ENV GITHUB_REF=$GITHUB_REF
9+ ENV REPO_URL=$REPO_URL
610
711RUN dnf -y install sudo && dnf -y groupinstall "Development Tools"
812
@@ -19,9 +23,65 @@ RUN dnf install --allowerasing --enablerepo=crb -y $(cat /home/pgedge/lib-list.t
1923RUN ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 && \
2024 cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
2125
22- COPY entrypoint.sh run-tests.sh /home/pgedge
2326
24- RUN sudo chmod +x /home/pgedge/entrypoint.sh /home/pgedge/run-tests.sh
27+ #-----------------------------------------
28+ USER pgedge
29+
30+ WORKDIR /home/pgedge
31+ RUN echo "Cloning Spock at $GITHUB_REF from $REPO_URL"
32+ RUN git clone ${REPO_URL}
33+
34+ WORKDIR /home/pgedge/spock
35+ RUN git checkout ${GITHUB_REF}
36+
37+ WORKDIR /home/pgedge
38+
39+ RUN echo "Determine PostgreSQL tag"
40+ RUN LATEST_TAG=$(git ls-remote --tags https://github.com/postgres/postgres.git | \
41+ grep "refs/tags/REL_${PGVER}_" | \
42+ sed 's|.*refs/tags/||' | \
43+ tr '_' '.' | \
44+ sort -V | \
45+ tail -n 1 | \
46+ tr '.' '_') && \
47+ echo "Using tag $LATEST_TAG" && \
48+ git clone --branch $LATEST_TAG --depth 1 https://github.com/postgres/postgres /home/pgedge/postgres
49+
50+
51+ RUN sudo chmod -R a+w ~/postgres
52+
53+ RUN echo "Setting up pgedge..."
54+ WORKDIR /home/pgedge
55+ RUN curl -fsSL https://pgedge-download.s3.amazonaws.com/REPO/install.py > /home/pgedge/install.py
56+ RUN sudo -u pgedge python3 /home/pgedge/install.py
57+
58+ #RUN ./pgedge setup -U $DBUSER -P $DBPASSWD -d $DBNAME --pg_ver=$PGVER && ./pgedge stop
59+
60+ WORKDIR /home/pgedge/postgres
61+
62+ RUN git apply --verbose /home/pgedge/spock/patches/pg${PGVER}*
63+
64+ RUN echo "==========Compiling Modified PostgreSQL=========="
65+ 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' 'LLVM_CONFIG=/usr/bin/llvm-config-64' '--with-openssl' '--with-systemd' '--enable-tap-tests' '--with-python' 'PYTHON=/usr/bin/python3.9' 'BITCODE_CFLAGS=-gdwarf-5 -O0 -fforce-dwarf-frame' 'CFLAGS=-g -O0'" && eval ./configure $options && make -j4 && make install
66+
67+ WORKDIR /home/pgedge
68+
69+ # TODO review
70+ #. /home/pgedge/pgedge/pg$PGVER/pg$PGVER.env
71+ RUN echo "export LD_LIBRARY_PATH=/home/pgedge/pgedge/pg$PGVER/lib/:$LD_LIBRARY_PATH" >> /home/pgedge/.bashrc
72+ RUN echo "export PATH=/home/test/pgedge/pg$PGVER/bin:$PATH" >> /home/pgedge/.bashrc
73+ #. /home/pgedge/.bashrc
74+
75+ RUN echo "==========Recompiling Spock=========="
76+ WORKDIR /home/pgedge/spock
77+ 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
78+
79+ RUN echo "==========Built Spock=========="
80+
81+ #-----------------------------------------
82+ COPY entrypoint.sh run-tests.sh run-spock-regress.sh /home/pgedge
83+
84+ RUN sudo chmod +x /home/pgedge/entrypoint.sh /home/pgedge/run-tests.sh /home/pgedge/run-spock-regress.sh
2585
2686WORKDIR /home/pgedge/
2787USER pgedge
0 commit comments