Dockerfile 2.37 KB
Newer Older
1
ARG VERSION=2.4.1
2
ARG PORTCHECKER_VERSION=v1.0.6
3
ARG SCVERSION=v0.1.12
4

5
FROM node:12.20.1-alpine3.12 as BUILD
6
ARG VERSION
7
ARG SCVERSION
8
RUN apk add --no-cache --virtual .gyp libressl-dev git bash python3 make && \
9
10
11
12
13
14
    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
15
16
17
COPY fr.dic /opt/codimd/public/vendor/codemirror-spell-checker/fr.dic
COPY fr.aff /opt/codimd/public/vendor/codemirror-spell-checker/fr.aff
COPY spellcheck.js /opt/codimd/public/js/lib/editor/spellcheck.js
18
19
20
21
22
23
24
25
26
RUN cd /opt/codimd && npm install && \
    npm run build && \
    cp ./deployments/docker-entrypoint.sh ./ && \
    cp .sequelizerc.example .sequelizerc && \
    rm -rf .git .gitignore .travis.yml .dockerignore .editorconfig .babelrc .mailmap .sequelizerc.example \
        test docs contribute \
        package-lock.json webpack.prod.js webpack.htmlexport.js webpack.dev.js webpack.common.js \
        config.json.example README.md CONTRIBUTING.md AUTHORS node_modules

27
FROM node:12.20.1-alpine3.12
28
ARG PORTCHECKER_VERSION
29
30
RUN addgroup --gid 5010 codimd && \
    adduser -u 5010 -G codimd -D codimd && \
31
32
    mkdir /home/$USER_NAME/.npm && \
    echo "prefix=/home/codimd/.npm/" > /home/$USER_NAME/.npmrc && \
33
    mkdir -p /home/codimd/app/deletedPads && \
34
    chown -R codimd:codimd /home/codimd && \
35
    # Git needed so NPM can clone packages and Python for node-gyp
36
    apk add --no-cache bash git python3-dev py3-pip gcc postgresql-dev musl-dev make && \
37
    pip3 install psycopg2 && \
38
    wget https://github.com/hackmdio/portchecker/releases/download/${PORTCHECKER_VERSION}/portchecker-linux-amd64.tar.gz && \
39
40
41
42
43
    tar xvf portchecker-linux-amd64.tar.gz -C /usr/local/bin && \
    mv /usr/local/bin/portchecker-linux-amd64 /usr/local/bin/pcheck && \
    rm portchecker-linux-amd64.tar.gz
USER codimd
WORKDIR /home/codimd/app
44
COPY --chown=5010:5010 --from=BUILD /opt/codimd .
45
COPY --chown=5010:5010 deleteOldPad.py .
46
RUN npm install --production && npm cache clean --force && rm -rf /tmp/{core-js-banners,phantomjs}
47
COPY entrypoint.sh .
48
COPY features.md /home/codimd/app/public/docs/features.md
49
EXPOSE 3000
50
ENTRYPOINT ["./entrypoint.sh"]