From bf5f06f2dd0dff6ee45b4753d8c2e8333fb982e2 Mon Sep 17 00:00:00 2001 From: Rory de Zoete Date: Thu, 18 Aug 2022 13:52:53 +0200 Subject: [PATCH] Update Dockerfile & Fix typo's --- .github/workflows/build_and_test.yml | 2 +- Dockerfile.compute-node | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 706edd746e..25ccc3de13 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -480,7 +480,7 @@ jobs: - name: Configure ECR login run: echo "{\"credsStore\":\"ecr-login\"}" > /kaniko/.docker/config.json - - name: Kaniko build compute tools + - name: Kaniko build compute node with extensions run: /kaniko/executor --snapshotMode=redo --cache=true --cache-repo 369495373322.dkr.ecr.eu-central-1.amazonaws.com/cache --snapshotMode=redo --context . --dockerfile Dockerfile.compute-node --destination 369495373322.dkr.ecr.eu-central-1.amazonaws.com/compute-node:$GITHUB_RUN_ID-ext compute-node-image: diff --git a/Dockerfile.compute-node b/Dockerfile.compute-node index 1f699bfdaa..bfbf7b5eed 100644 --- a/Dockerfile.compute-node +++ b/Dockerfile.compute-node @@ -16,19 +16,22 @@ RUN git clone -b main https://github.com/neondatabase/postgres.git postgres && \ # Install headers make MAKELEVEL=0 -j $(getconf _NPROCESSORS_ONLN) -s -C src/include install -# Build PostGIS from upstream the upstream PostGIS mirror. PostGIS compiles against neon postgres sources without changes. +# Build PostGIS from the upstream PostGIS mirror. PostGIS compiles against neon postgres sources without changes. # Perhaps we could even use the upstream binaries, compiled against vanilla Postgres, but it would require some # investigation to check that it works, and also keeps working in the future. So for now, we compile our own binaries. FROM build-deps AS postgis-build COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/ RUN apt update && \ - apt install -y gdal-bin libgdal-dev libprotobuf-c-dev protobuf-c-compiler + apt install -y gdal-bin libgdal-dev libprotobuf-c-dev protobuf-c-compiler xsltproc RUN git clone -b stable-3.2 https://github.com/postgis/postgis.git postgis && \ cd postgis && \ ./autogen.sh && \ export PATH="/usr/local/pgsql/bin:$PATH" && \ ./configure && \ + make -j $(getconf _NPROCESSORS_ONLN) install && \ + cd extensions/postgis && \ + make clean && \ make -j $(getconf _NPROCESSORS_ONLN) install # Compile and run the Neon-specific `compute_ctl` binary @@ -47,11 +50,12 @@ RUN mkdir /var/db && useradd -m -d /var/db/postgres postgres && \ echo "postgres:test_console_pass" | chpasswd && \ mkdir /var/db/postgres/compute && mkdir /var/db/postgres/specs && \ chown -R postgres:postgres /var/db/postgres && \ - chmod 0750 /var/db/postgres/compute + chmod 0750 /var/db/postgres/compute && \ + export PATH="/usr/local/pgsql/bin:$PATH" && \ + echo '/usr/local/lib' >> /etc/ld.so.conf && /sbin/ldconfig -RUN echo '/usr/local/lib' >> /etc/ld.so.conf && /sbin/ldconfig - -#COPY --from=pg-build /usr/local/pgsql /usr/local/pgsql +#COPY --from=pg-build /usr/local/pgsql /usr/local/pgsq +# TODO: Implement better approach to only copy the added files for each extension COPY --from=postgis-build /usr/local/pgsql /usr/local/pgsql COPY --from=compute-tools /home/nonroot/compute_tools/target/release/compute_ctl /usr/local/bin/compute_ctl