FROM http-garden-soil:latest

RUN apt -y update && apt -y upgrade && apt -y install --no-install-recommends perl autoconf automake libssl-dev texinfo

ARG APP_REPO
RUN git clone --recurse-submodules "$APP_REPO"

ARG APP_VERSION

RUN cd /app/pound && git pull && git checkout "$APP_VERSION" && ./bootstrap && export CC='afl-cc' LDFLAGS='-fsanitize=address,undefined' CFLAGS='-fsanitize=address,undefined -g' && ./configure && make -j$(nproc) && make install

COPY pound.cfg /usr/local/etc/pound.cfg
ARG BACKEND
RUN sed -i "s/PROXY_BACKEND_PLACEHOLDER/$BACKEND/g" /usr/local/etc/pound.cfg && mkdir -p /usr/local/var/run

CMD ["afl-showmap", "-o", "/tmp/trace", "-t", "2147483647", "--", "pound", "-e"]
