Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Fix libpq for Docker multi-arch builds and Bookworm upgrade #7921

Merged
Next Next commit
docker: add libpq for multi-arch build configuration
  • Loading branch information
arowser authored and ShahanaFarooqui committed Jan 14, 2025
commit 1fa242b624a450529d9a9805d4c4bc93a1c1e08e
26 changes: 22 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ RUN pip3 install --upgrade pip setuptools wheel
RUN poetry self add poetry-plugin-export

RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz -O zlib.tar.gz && \
wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip -O sqlite.zip
wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip -O sqlite.zip \
wget -q https://ftp.postgresql.org/pub/source/v17.1/postgresql-17.1.tar.gz -O postgres.tar.gz

WORKDIR /opt/lightningd
COPY . /tmp/lightning
Expand Down Expand Up @@ -129,7 +130,8 @@ QEMU_LD_PREFIX=/usr/${target_host} \
HOST=${target_host} \
TARGET=${target_host_rust} \
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig" \
PG_CONFIG_PATH="/usr/${target_host}/bin/pg_config"

ENV \
ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
Expand All @@ -156,11 +158,13 @@ QEMU_LD_PREFIX=/usr/${target_host} \
HOST=${target_host} \
TARGET=${target_host_rust} \
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig" \
PG_CONFIG_PATH="/usr/${target_host}/bin/pg_config"

ENV \
ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
SQLITE_CONFIG="--host=${target_host} --prefix=$QEMU_LD_PREFIX"
SQLITE_CONFIG="--host=${target_host} --prefix=$QEMU_LD_PREFIX" \
POSTGRES_CONFIG="--without-readline --prefix=${QEMU_LD_PREFIX}"

FROM base-builder-${TARGETOS}-${TARGETARCH} AS builder

Expand All @@ -180,6 +184,20 @@ RUN unzip sqlite.zip \
&& make \
&& make install && cd .. && rm sqlite.zip && rm -rf sqlite-*

RUN mkdir postgres && tar xvf postgres.tar.gz -C postgres --strip-components=1 \
&& cd postgres \
&& ./configure ${POSTGRES_CONFIG} \
&& cd src/include \
&& make install \
&& cd ../interfaces/libpq \
&& make install \
&& cd ../../bin/pg_config \
&& make install \
&& cd ../../../../ && \
rm postgres.tar.gz && \
rm -rf postgres && \
ldconfig "$(${PG_CONFIG} --libdir)"

ENV RUST_PROFILE=release
ENV PATH="/root/.cargo/bin:/root/.local/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}
Expand Down