FROM bionic

ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN sed -i '/updates/d' /etc/apt/sources.list && \
    sed -i '/security/d' /etc/apt/sources.list

RUN apt-get update \
	&& apt-get install -y --no-install-recommends \
      ca-certificates \
	sudo \
	build-essential \
	libsodium23 \
	python3-setuptools \
	libpq-dev \
	git \
	file \
	autoconf \
	debianutils \
	gettext \
	zip \
	unzip \
	wget

RUN wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py && python3 /tmp/get-pip.py \
	&& rm /tmp/get-pip.py \
	&& pip install mrkd mako

RUN mkdir /build
WORKDIR /build

CMD git clone /repo /build \
	&& tools/build-release.sh zipfile \
	&& mkdir -p /repro \
	&& cd /repro \
	&& unzip /build/release/*.zip \
	&& cd clightning* \
	&& tools/repro-build.sh \
	&& cp *.xz /build/release/* /repo/release/ \
	&& cd /repo/release \
	&& sha256sum *
