Verified Commit 46384f35 authored by Romain De Laage De Bellefaye's avatar Romain De Laage De Bellefaye 🌳
Browse files

[CodiMD] Add supercronic to autoremove old pads each night

parent bdf82b78
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 .
......
0 0 * * * /home/codimd/app/deleteOldPad.py
#! /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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment