Skip to content

Commit

Permalink
H2O: Use the PostgreSQL project's Apt repository for libpq (#9294)
Browse files Browse the repository at this point in the history
  • Loading branch information
volyrique authored Oct 1, 2024
1 parent 5b3f9b0 commit 5b93494
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions frameworks/C/h2o/h2o.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@ FROM "ubuntu:${UBUNTU_VERSION}" AS compile

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -yqq update && \
apt-get -yqq install \
ca-certificates \
curl \
lsb-release && \
install -dm755 /usr/share/postgresql-common/pgdg && \
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
/etc/apt/sources.list.d/pgdg.list' && \
apt-get -yqq update && \
apt-get -yqq install \
autoconf \
bison \
cmake \
curl \
flex \
g++ \
libbpfcc-dev \
libbrotli-dev \
libcap-dev \
libicu-dev \
libnuma-dev \
libreadline-dev \
libpq-dev \
libssl-dev \
libtool \
libuv1-dev \
Expand Down Expand Up @@ -57,18 +66,6 @@ RUN curl -LSs "https://github.com/x86-64/mustache-c/archive/${MUSTACHE_C_REVISIO
CFLAGS="-flto -march=native -mtune=native -O3" ./autogen.sh && \
make -j "$(nproc)" install

ARG POSTGRESQL_VERSION=a37bb7c13995b834095d9d064cad1023a6f99b10

WORKDIR /tmp/postgresql-build
RUN curl -LSs "https://github.com/postgres/postgres/archive/${POSTGRESQL_VERSION}.tar.gz" | \
tar --strip-components=1 -xz && \
CFLAGS="-flto -march=native -mtune=native -O3" ./configure \
--includedir=/usr/local/include/postgresql \
--prefix=/usr/local \
--with-ssl=openssl && \
make -j "$(nproc)" -C src/include install && \
make -j "$(nproc)" -C src/interfaces/libpq install

ARG H2O_APP_PREFIX
WORKDIR /tmp/build
COPY CMakeLists.txt ../
Expand All @@ -85,15 +82,28 @@ RUN cmake \

FROM "ubuntu:${UBUNTU_VERSION}"

ARG POSTGRESQL_VERSION=17

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -yqq update && \
apt-get -yqq install \
ca-certificates \
curl \
lsb-release && \
install -dm755 /usr/share/postgresql-common/pgdg && \
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
/etc/apt/sources.list.d/pgdg.list' && \
apt-get -yqq update && \
apt-get -yqq install \
libnuma1 \
libyajl2
libyajl2 \
"postgresql-client-${POSTGRESQL_VERSION}"
ARG H2O_APP_PREFIX
COPY --from=compile "${H2O_APP_PREFIX}" "${H2O_APP_PREFIX}/"
COPY --from=compile /usr/local/lib/libmustache_c.so "${H2O_APP_PREFIX}/lib/"
COPY --from=compile /usr/local/lib/libpq.so.5.17 "${H2O_APP_PREFIX}/lib/libpq.so.5"
ENV LD_LIBRARY_PATH="${H2O_APP_PREFIX}/lib"
EXPOSE 8080
ARG BENCHMARK_ENV
Expand Down

0 comments on commit 5b93494

Please sign in to comment.