diff --git a/pica-codimd/Dockerfile b/pica-codimd/Dockerfile index fe3ce09cc0d0bf250b4d2c804331f9aea93e2257..75669481b2ed7cd6a21f87f3b3b6b7b4cb5add83 100644 --- a/pica-codimd/Dockerfile +++ b/pica-codimd/Dockerfile @@ -1,12 +1,17 @@ ARG VERSION=2.2.0 ARG PORTCHECKER_VERSION=v1.0.6 +ARG SCVERSION=v0.1.11 FROM node:10.22.1-alpine3.11 as BUILD ARG VERSION +ARG SCVERSION RUN apk add --no-cache --virtual .gyp libressl-dev git bash python make && \ -wget https://github.com/hackmdio/codimd/archive/${VERSION}.tar.gz && \ -tar xzf $VERSION.tar.gz -C /opt && \ -mv /opt/codimd-$VERSION /opt/codimd + wget https://github.com/hackmdio/codimd/archive/${VERSION}.tar.gz && \ + tar xzf $VERSION.tar.gz -C /opt && \ + mv /opt/codimd-$VERSION /opt/codimd && \ + wget https://github.com/aptible/supercronic/releases/download/$SCVERSION/supercronic-linux-amd64 && \ + chmod +x supercronic-linux-amd64 && \ + mv supercronic-linux-amd64 /opt/codimd/supercronic RUN cd /opt/codimd && npm install && \ npm run build && \ @@ -26,7 +31,7 @@ RUN addgroup --gid 5010 codimd && \ mkdir -p /home/codimd/app/deletedPads && \ chown -R codimd:codimd /home/codimd && \ # Git needed so NPM can clone packages and Python for node-gyp - apk add --no-cache bash git python3-dev py3-pip gcc postgresql-dev musl-dev && \ + apk add --no-cache bash git python3-dev py3-pip gcc postgresql-dev musl-dev make && \ pip3 install psycopg2 && \ wget https://github.com/hackmdio/portchecker/releases/download/${PORTCHECKER_VERSION}/portchecker-linux-amd64.tar.gz && \ tar xvf portchecker-linux-amd64.tar.gz -C /usr/local/bin && \ @@ -41,6 +46,8 @@ COPY --chown=5010:5010 --from=BUILD /opt/codimd . COPY --chown=5010:5010 deleteOldPad.py . +COPY crontab . + RUN npm install --production && npm cache clean --force && rm -rf /tmp/{core-js-banners,phantomjs} COPY entrypoint.sh . diff --git a/pica-codimd/crontab b/pica-codimd/crontab new file mode 100644 index 0000000000000000000000000000000000000000..3e7cbc581f88f8bc9e9219edd1e91d199d8fb05e --- /dev/null +++ b/pica-codimd/crontab @@ -0,0 +1 @@ +0 0 * * * /home/codimd/app/deleteOldPad.py diff --git a/pica-codimd/entrypoint.sh b/pica-codimd/entrypoint.sh index 37b9c2f8fbc266c9a3b6d9806a38b2af42cad581..b1bb458995d2152b81fa7b0d64118b65059fb5c4 100755 --- a/pica-codimd/entrypoint.sh +++ b/pica-codimd/entrypoint.sh @@ -1,5 +1,6 @@ #! /bin/sh sed "154a | <a href=\"https://picasoft.net/co/cgu.html\">CGU</a> " -i /home/codimd/app/public/views/index/body.ejs - -/home/codimd/app/docker-entrypoint.sh +sed "41a Cette instance ne garde le contenu que deux ans après la dernière modification !" -i /home/codimd/app/public/views/index/body.ejs +/home/codimd/app/docker-entrypoint.sh & +/home/codimd/app/supercronic /home/codimd/app/crontab