Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions buildpack-24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM node:24.11.0-bookworm

ENV DEBIAN_VERSION_NAME=bookworm

ARG USER_NAME=hackmd
ARG UID=1500
ARG GID=1500

RUN set -xe && \
# upgrade system
apt-get update && \
apt-get upgrade -y && \
# install postgres client
apt-get install -y --no-install-recommends postgresql-client-15 && \
rm -rf /var/lib/apt/lists/* && \
# upgrade npm to v10
npm -g install npm@10 && \
# install node-prune
npm i -g node-prune && npm cache clean --force && \
# Add user and groupd
groupadd --gid $GID $USER_NAME && \
useradd --uid $UID --gid $USER_NAME --no-log-init --create-home $USER_NAME && \
mkdir -p /home/$USER_NAME/.npm && \
mkdir -p /home/$USER_NAME/.ssh && \
mkdir -p /home/$USER_NAME/git && \
mkdir -p /home/$USER_NAME/app && \
echo "prefix=/home/$USER_NAME/.npm/" > /home/$USER_NAME/.npmrc && \
git config --global credential.helper 'store --file /home/$USER_NAME/git/credentials' && \
# adjust permissions
chown -R $USER_NAME:$USER_NAME /home/$USER_NAME

USER hackmd
ENV PATH="/home/hackmd/.npm/bin:$PATH"
WORKDIR /home/$USER_NAME/app
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["node"]
44 changes: 44 additions & 0 deletions runtime-24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM node:24.11.0-bookworm

ENV DEBIAN_VERSION_NAME=bookworm
ENV NODE_ENV=production
ENV PORTCHECKER_VERSION=v1.1.0

ARG USER_NAME=hackmd
ARG UID=1500
ARG GID=1500

ADD common/fonts/*.otf /usr/share/fonts/opentype/noto/
ADD common/fonts/*.ttf /usr/share/fonts/truetype/noto/
# add font conf for fonts orders
ADD common/local.conf /etc/fonts/

RUN set -xe && \
apt-get update && \
apt-get upgrade -y && \
# install postgres client
apt-get install -y --no-install-recommends postgresql-client-15 && \
rm -rf /var/lib/apt/lists/* && \
# install pchecker
wget https://github.com/hackmdio/portchecker/releases/download/${PORTCHECKER_VERSION}/portchecker-linux-$(dpkg --print-architecture).tar.gz && \
tar xvf portchecker-linux-$(dpkg --print-architecture).tar.gz -C /usr/local/bin && \
mv /usr/local/bin/portchecker-linux-$(dpkg --print-architecture) /usr/local/bin/pcheck && \
rm portchecker-linux-$(dpkg --print-architecture).tar.gz && \
# Add user and group
groupadd --gid $GID $USER_NAME && \
useradd --uid $UID --gid $GID --no-log-init --create-home $USER_NAME && \
mkdir /home/$USER_NAME/.npm && \
echo "prefix=/home/$USER_NAME/.npm/" > /home/$USER_NAME/.npmrc && \
# setup app dir
mkdir -p /home/$USER_NAME/app && \
# adjust permission
chown -R $USER_NAME:$USER_NAME /home/$USER_NAME && \
fc-cache -f -v && \
dpkg-reconfigure fontconfig-config && \
dpkg-reconfigure fontconfig

USER hackmd
ENV PATH="/home/hackmd/.npm/bin:$PATH"
WORKDIR /home/$USER_NAME/app
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["node"]