FROM ubuntu:18.04

RUN apt-get update && apt-get install --yes \
    autoconf \
    automake \
    gcc \
    libtool \
    make

RUN useradd builder
RUN mkdir /json-c-install && chown builder:nogroup /json-c-install
USER builder

COPY --chown=builder:nogroup ./json-c /json-c
WORKDIR /json-c
RUN sh autogen.sh
RUN ./configure --prefix=/json-c-install --enable-threading
RUN make
RUN make check
RUN make install