|
| 1 | +FROM node:15.12.0-buster |
| 2 | + |
| 3 | +ENV DEBIAN_VERSION_NAME=jessie NODE_ENV=production |
| 4 | + |
| 5 | +ARG USER_NAME=hackmd |
| 6 | +ARG UID=1500 |
| 7 | +ARG GID=1500 |
| 8 | + |
| 9 | +ADD common/fonts/*.otf /usr/share/fonts/opentype/noto/ |
| 10 | +ADD common/fonts/*.ttf /usr/share/fonts/truetype/noto/ |
| 11 | +# add font conf for fonts orders |
| 12 | +ADD common/local.conf /etc/fonts/ |
| 13 | + |
| 14 | +RUN set -xe && \ |
| 15 | + apt-get update && \ |
| 16 | + # install postgres client |
| 17 | + apt-get install -y --no-install-recommends apt-transport-https && \ |
| 18 | + echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION_NAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ |
| 19 | + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ |
| 20 | + apt-get update && \ |
| 21 | + apt-get install -y --no-install-recommends postgresql-client-11 && \ |
| 22 | + rm -rf /var/lib/apt/lists/* && \ |
| 23 | + # install pchecker |
| 24 | + wget https://github.com/hackmdio/portchecker/releases/download/v1.0.5/portchecker-linux-amd64.tar.gz && \ |
| 25 | + tar xvf portchecker-linux-amd64.tar.gz -C /usr/local/bin && \ |
| 26 | + mv /usr/local/bin/portchecker-linux-amd64 /usr/local/bin/pcheck && \ |
| 27 | + rm portchecker-linux-amd64.tar.gz && \ |
| 28 | + # Add user and groupd |
| 29 | + groupadd --gid $GID $USER_NAME && \ |
| 30 | + useradd --uid $UID --gid $USER_NAME --no-log-init --create-home $USER_NAME && \ |
| 31 | + mkdir /home/$USER_NAME/.npm && \ |
| 32 | + echo "prefix=/home/$USER_NAME/.npm/" > /home/$USER_NAME/.npmrc && \ |
| 33 | + # setup app dir |
| 34 | + mkdir -p /home/$USER_NAME/app && \ |
| 35 | + # adjust permission |
| 36 | + chown -R $USER_NAME:$USER_NAME /home/$USER_NAME && \ |
| 37 | + fc-cache -f -v && \ |
| 38 | + dpkg-reconfigure fontconfig-config && \ |
| 39 | + dpkg-reconfigure fontconfig |
| 40 | + |
| 41 | +USER hackmd |
| 42 | +ENV PATH="/home/hackmd/.npm/bin:$PATH" |
| 43 | +WORKDIR /home/$USER_NAME/app |
| 44 | +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] |
| 45 | +CMD ["node"] |
| 46 | + |
0 commit comments