FROM node:18.10.0


ENV TERM=linux
ENV NODE_OPTIONS=--openssl-legacy-provider

WORKDIR "/vp"

COPY init.json package.json

RUN apt-get update
RUN apt-get install vim -y
RUN npm install -D vuepress -loglevel verbose

COPY package.json package.json
COPY dot_vuepress /tmp/stash/dot_vuepress
COPY README.md /tmp/stash/README.md
COPY demo /tmp/stash/demo

RUN npm install -D @vuepress/plugin-register-components -loglevel verbose
# RUN npm install nextapps-de/flexsearch#0.6.22 -loglevel verbose

ARG modules="directory-tree vuepress-plugin-code-copy vuepress-plugin-graphviz vuepress-plugin-mermaidjs vuepress-plugin-tabs vue-tabs-component markdown-it-html5-embed"

RUN for mod in ${modules} ; do npm install --save-dev $mod -loglevel verbose ; done

COPY match-query.js node_modules/@vuepress/plugin-search/match-query.js

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD [ "npm" , "run" , "docs:dev" ]
