Skip to content

Commit 5b93494

Browse files
authored
H2O: Use the PostgreSQL project's Apt repository for libpq (#9294)
1 parent 5b3f9b0 commit 5b93494

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

frameworks/C/h2o/h2o.dockerfile

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ FROM "ubuntu:${UBUNTU_VERSION}" AS compile
66

77
ARG DEBIAN_FRONTEND=noninteractive
88
RUN apt-get -yqq update && \
9+
apt-get -yqq install \
10+
ca-certificates \
11+
curl \
12+
lsb-release && \
13+
install -dm755 /usr/share/postgresql-common/pgdg && \
14+
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
15+
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
16+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
17+
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
18+
/etc/apt/sources.list.d/pgdg.list' && \
19+
apt-get -yqq update && \
920
apt-get -yqq install \
1021
autoconf \
1122
bison \
1223
cmake \
13-
curl \
1424
flex \
1525
g++ \
1626
libbpfcc-dev \
1727
libbrotli-dev \
1828
libcap-dev \
19-
libicu-dev \
2029
libnuma-dev \
21-
libreadline-dev \
30+
libpq-dev \
2231
libssl-dev \
2332
libtool \
2433
libuv1-dev \
@@ -57,18 +66,6 @@ RUN curl -LSs "https://github.com/x86-64/mustache-c/archive/${MUSTACHE_C_REVISIO
5766
CFLAGS="-flto -march=native -mtune=native -O3" ./autogen.sh && \
5867
make -j "$(nproc)" install
5968

60-
ARG POSTGRESQL_VERSION=a37bb7c13995b834095d9d064cad1023a6f99b10
61-
62-
WORKDIR /tmp/postgresql-build
63-
RUN curl -LSs "https://github.com/postgres/postgres/archive/${POSTGRESQL_VERSION}.tar.gz" | \
64-
tar --strip-components=1 -xz && \
65-
CFLAGS="-flto -march=native -mtune=native -O3" ./configure \
66-
--includedir=/usr/local/include/postgresql \
67-
--prefix=/usr/local \
68-
--with-ssl=openssl && \
69-
make -j "$(nproc)" -C src/include install && \
70-
make -j "$(nproc)" -C src/interfaces/libpq install
71-
7269
ARG H2O_APP_PREFIX
7370
WORKDIR /tmp/build
7471
COPY CMakeLists.txt ../
@@ -85,15 +82,28 @@ RUN cmake \
8582

8683
FROM "ubuntu:${UBUNTU_VERSION}"
8784

85+
ARG POSTGRESQL_VERSION=17
86+
8887
ARG DEBIAN_FRONTEND=noninteractive
8988
RUN apt-get -yqq update && \
89+
apt-get -yqq install \
90+
ca-certificates \
91+
curl \
92+
lsb-release && \
93+
install -dm755 /usr/share/postgresql-common/pgdg && \
94+
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
95+
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
96+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
97+
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
98+
/etc/apt/sources.list.d/pgdg.list' && \
99+
apt-get -yqq update && \
90100
apt-get -yqq install \
91101
libnuma1 \
92-
libyajl2
102+
libyajl2 \
103+
"postgresql-client-${POSTGRESQL_VERSION}"
93104
ARG H2O_APP_PREFIX
94105
COPY --from=compile "${H2O_APP_PREFIX}" "${H2O_APP_PREFIX}/"
95106
COPY --from=compile /usr/local/lib/libmustache_c.so "${H2O_APP_PREFIX}/lib/"
96-
COPY --from=compile /usr/local/lib/libpq.so.5.17 "${H2O_APP_PREFIX}/lib/libpq.so.5"
97107
ENV LD_LIBRARY_PATH="${H2O_APP_PREFIX}/lib"
98108
EXPOSE 8080
99109
ARG BENCHMARK_ENV

0 commit comments

Comments
 (0)