Skip to content

Commit 07c1a7f

Browse files
arowserShahanaFarooqui
authored andcommitted
docker: add libpq for multi-arch build configuration
1 parent 9ce885b commit 07c1a7f

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

Dockerfile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ RUN pip3 install --upgrade pip setuptools wheel
9595
RUN poetry self add poetry-plugin-export
9696

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

100101
WORKDIR /opt/lightningd
101102
COPY . /tmp/lightning
@@ -129,7 +130,8 @@ QEMU_LD_PREFIX=/usr/${target_host} \
129130
HOST=${target_host} \
130131
TARGET=${target_host_rust} \
131132
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
132-
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
133+
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig" \
134+
PG_CONFIG_PATH="/usr/${target_host}/bin/pg_config"
133135

134136
ENV \
135137
ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
@@ -156,11 +158,13 @@ QEMU_LD_PREFIX=/usr/${target_host} \
156158
HOST=${target_host} \
157159
TARGET=${target_host_rust} \
158160
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
159-
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
161+
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig" \
162+
PG_CONFIG_PATH="/usr/${target_host}/bin/pg_config"
160163

161164
ENV \
162165
ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
163-
SQLITE_CONFIG="--host=${target_host} --prefix=$QEMU_LD_PREFIX"
166+
SQLITE_CONFIG="--host=${target_host} --prefix=$QEMU_LD_PREFIX" \
167+
POSTGRES_CONFIG="--without-readline --prefix=${QEMU_LD_PREFIX}"
164168

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

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

187+
RUN mkdir postgres && tar xvf postgres.tar.gz -C postgres --strip-components=1 \
188+
&& cd postgres \
189+
&& ./configure ${POSTGRES_CONFIG} \
190+
&& cd src/include \
191+
&& make install \
192+
&& cd ../interfaces/libpq \
193+
&& make install \
194+
&& cd ../../bin/pg_config \
195+
&& make install \
196+
&& cd ../../../../ && \
197+
rm postgres.tar.gz && \
198+
rm -rf postgres && \
199+
ldconfig "$(${PG_CONFIG} --libdir)"
200+
183201
ENV RUST_PROFILE=release
184202
ENV PATH="/root/.cargo/bin:/root/.local/bin:$PATH"
185203
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}

0 commit comments

Comments
 (0)