Skip to content

Commit 9bff4b1

Browse files
committed
feat: add support for Node.js 18.15 runtime and buildpack with updated Dockerfiles
1 parent 83984c3 commit 9bff4b1

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
```
44
./build-multi-arch.sh runtime-16 runtime 16.20.2
5+
./build-multi-arch.sh runtime-18.15 runtime 18.15.0
6+
./build-multi-arch.sh buildpack-18.15 buildpack 18.15.0
57
```

buildpack-18.15/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM node:18.15.0-bullseye
2+
3+
ENV DEBIAN_VERSION_NAME bullseye
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+
if [ $(dpkg --print-architecture) = "arm64" ];then apt-get install -y --no-install-recommends phantomjs; fi && \
18+
rm -rf /var/lib/apt/lists/* && \
19+
# upgrade npm to 6.10
20+
npm i -g npm@9.6.0 && \
21+
# install node-prune
22+
npm i -g node-prune && npm cache clean --force && \
23+
# Add user and groupd
24+
groupadd --gid $GID $USER_NAME && \
25+
useradd --uid $UID --gid $USER_NAME --no-log-init --create-home $USER_NAME && \
26+
mkdir /home/$USER_NAME/.npm && \
27+
echo "prefix=/home/$USER_NAME/.npm/" > /home/$USER_NAME/.npmrc && \
28+
# setup github ssh key
29+
mkdir -p /home/hackmd/.ssh && \
30+
# ssh-keyscan -H github.com >> /home/hackmd/.ssh/known_hosts && \
31+
# setup git credential helper
32+
mkdir -p /home/hackmd/git && \
33+
git config --global credential.helper 'store --file /home/$USER_NAME/git/credentials' && \
34+
# setup app dir
35+
mkdir -p /home/$USER_NAME/app && \
36+
# adjust permission
37+
chown -R $USER_NAME:$USER_NAME /home/$USER_NAME
38+
39+
USER hackmd
40+
ENV PATH="/home/hackmd/.npm/bin:$PATH"
41+
WORKDIR /home/$USER_NAME/app
42+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
43+
CMD ["node"]

runtime-18.15/Dockerfile

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

Comments
 (0)