Skip to content

Commit a9e7f98

Browse files
committed
feat: add node 15.12.0 buildpack and runtime
1 parent 95f094f commit a9e7f98

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

buildpack-15/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM node:15.12.0-buster
2+
3+
ENV DEBIAN_VERSION_NAME buster
4+
5+
ARG USER_NAME=hackmd
6+
ARG UID=1500
7+
ARG GID=1500
8+
9+
RUN set -xe && \
10+
apt-get update && \
11+
# install postgres client
12+
apt-get install -y --no-install-recommends apt-transport-https && \
13+
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION_NAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
14+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
15+
apt-get update && \
16+
apt-get install -y --no-install-recommends postgresql-client-11 && \
17+
rm -rf /var/lib/apt/lists/* && \
18+
# upgrade npm to 6.10
19+
npm i -g npm@7.7.0 && \
20+
# install node-prune
21+
npm i -g node-prune && npm cache clean --force && \
22+
# Add user and groupd
23+
groupadd --gid $GID $USER_NAME && \
24+
useradd --uid $UID --gid $USER_NAME --no-log-init --create-home $USER_NAME && \
25+
mkdir /home/$USER_NAME/.npm && \
26+
echo "prefix=/home/$USER_NAME/.npm/" > /home/$USER_NAME/.npmrc && \
27+
# setup github ssh key
28+
mkdir -p /home/hackmd/.ssh && \
29+
# ssh-keyscan -H github.com >> /home/hackmd/.ssh/known_hosts && \
30+
# setup git credential helper
31+
mkdir -p /home/hackmd/git && \
32+
git config --global credential.helper 'store --file /home/$USER_NAME/git/credentials' && \
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+
38+
USER hackmd
39+
ENV PATH="/home/hackmd/.npm/bin:$PATH"
40+
WORKDIR /home/$USER_NAME/app
41+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
42+
CMD ["node"]

runtime-15/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

Comments
 (0)