FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential cmake zlib1g-dev libmbedtls-dev libssl-dev pkg-config ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Ensure /bin/sh supports bash-style options used by test scripts
RUN ln -sf /bin/bash /bin/sh
# Build from source inside the image
WORKDIR /usr/src/libevent
# Copy the source into the image
COPY . .
# Configure and build the project from source, and install it
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build -- -j$(nproc) \
&& cmake --install build
# Update the shared library cache for installed in /usr/local
RUN ldconfig
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Default to an interactive shell so the container remains usable
CMD ["/bin/bash"]