Skip to content

Commit

Permalink
add libpq for multi-arch build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
arowser committed Nov 18, 2024
1 parent e66653f commit 8fb72c2
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN pip3 install --upgrade pip setuptools wheel

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 @@ -128,7 +129,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 @@ -155,11 +157,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 @@ -179,6 +183,19 @@ 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

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

0 comments on commit 8fb72c2

Please sign in to comment.