Update Dockerfile

This commit is contained in:
Rory de Zoete
2022-08-22 12:58:45 +02:00
parent 093a1f21ce
commit 2740f297fc

View File

@@ -2,7 +2,7 @@ ARG COMPUTE_TOOLS_TAG=latest
FROM debian:bullseye-slim AS build-deps
RUN apt update && \
apt install -y git automake libtool build-essential bison flex libreadline-dev zlib1g-dev libxml2-dev \
apt install -y git autoconf automake libtool build-essential bison flex libreadline-dev zlib1g-dev libxml2-dev \
libcurl4-openssl-dev libossp-uuid-dev
# Build Postgres from the neon postgres repository.
@@ -22,10 +22,11 @@ RUN git clone -b main https://github.com/neondatabase/postgres.git postgres && \
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 xsltproc
apt install -y gdal-bin libgdal-dev libprotobuf-c-dev protobuf-c-compiler xsltproc wget
RUN git clone -b stable-3.2 https://github.com/postgis/postgis.git postgis && \
cd postgis && \
RUN wget https://download.osgeo.org/postgis/source/postgis-3.2.3.tar.gz && \
tar xvzf postgis-3.2.3.tar.gz && \
cd postgis-3.2.3 && \
./autogen.sh && \
export PATH="/usr/local/pgsql/bin:$PATH" && \
./configure && \
@@ -34,6 +35,25 @@ RUN git clone -b stable-3.2 https://github.com/postgis/postgis.git postgis && \
make clean && \
make -j $(getconf _NPROCESSORS_ONLN) install
# Build plv8
FROM build-deps AS plv8-build
COPY --from=postgis-build /usr/local/pgsql/ /usr/local/pgsql/
RUN apt update && \
apt install -y git curl wget make ninja-build build-essential libncurses5 python3-dev pkg-config libc++-dev libc++abi-dev libglib2.0-dev
# https://github.com/plv8/plv8/issues/475
# Debian bullseye provides binutils 2.35 when >= 2.38 is necessary
RUN echo "deb http://ftp.debian.org/debian testing main" >> /etc/apt/sources.list && \
echo "APT::Default-Release \"stable\";" > /etc/apt/apt.conf.d/default-release && \
apt update && \
apt install -y --no-install-recommends -t testing binutils
RUN wget https://github.com/plv8/plv8/archive/refs/tags/v3.1.3.tar.gz && \
tar xvzf v3.1.3.tar.gz && \
cd plv8-3.1.3 && \
export PATH="/usr/local/pgsql/bin:$PATH" && \
make
# Compile and run the Neon-specific `compute_ctl` binary
FROM 369495373322.dkr.ecr.eu-central-1.amazonaws.com/rust:$COMPUTE_TOOLS_TAG AS compute-tools
COPY compute_tools compute_tools
@@ -56,7 +76,7 @@ RUN mkdir /var/db && useradd -m -d /var/db/postgres postgres && \
ENV PATH=/usr/local/pgsql/bin:$PATH
#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=plv8-build /usr/local/pgsql /usr/local/pgsql
COPY --from=compute-tools /home/nonroot/compute_tools/target/release/compute_ctl /usr/local/bin/compute_ctl
USER postgres