FROM alpine
RUN apk update && apk add \
	make \
	gcc \
	musl-dev \
	wget
COPY --from=libopenssl:3.1.1-minimal /opt/spm/openssl-3.1.1/ /usr/local/
RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
RUN tar -xf libevent-2.1.12-stable.tar.gz
WORKDIR /libevent-2.1.12-stable
ARG PREFIX=/opt/spm/libevent-2.1.12
RUN ./configure \
    --prefix=$PREFIX \
    --enable-shared=no \
    CFLAGS='-ffunction-sections -fdata-sections -Os'
RUN make -j$(nproc --all)
RUN make install
