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