FROM alpine as builder

RUN apk add -U fossil musl-dev ca-certificates zlib-dev openssl-dev gcc make file

RUN fossil clone --user root https://www.fossil-scm.org/ /fossil.fossil

WORKDIR /fossil

RUN fossil open /fossil.fossil

RUN ./configure --static --json --disable-fusefs && make -j$(nproc)

RUN strip fossil

RUN ls -lh fossil; file fossil; ldd fossil

FROM scratch

COPY --from=builder /fossil/fossil /fossil

WORKDIR /museum

EXPOSE 9000
ENTRYPOINT ["/fossil", "server", "--port=9000", "--repolist", "/museum"]
