FROM basex/basexhttp:latest

COPY ./bashrc /srv/.bashrc
COPY ./inputrc /srv/.inputrc

# RUN basex "db:create('gdp','/srv/basex/src/gdp.tei.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"

COPY ./gdp-entrypoint.sh /usr/local/bin
USER root
RUN chmod +x /usr/local/bin/gdp-entrypoint.sh
# RUN ln -s /usr/local/bin/gdp-entrypoint.sh /srv/ # backwards compat
USER basex
CMD ["/bin/sh","/usr/local/bin/gdp-entrypoint.sh"]