1
0
Fork 0

feat(remark42): initial image
All checks were successful
multi-semantic-release / multi-semantic-release (push) Successful in 23s

This commit is contained in:
Sergio Talens-Oliag 2025-03-15 10:33:28 +01:00
parent 0ce532965c
commit fad2cbc26e
Signed by: sto
GPG key ID: 821AEE0FD167FBDF
2 changed files with 44 additions and 0 deletions

2
remark42/Dockerfile Normal file
View file

@ -0,0 +1,2 @@
FROM umputun/remark42:v1.14.0
COPY init.sh /init.sh

42
remark42/init.sh Executable file
View file

@ -0,0 +1,42 @@
#!/sbin/dinit /bin/sh
uid="$(id -u)"
if [ "${uid}" -eq "0" ]; then
echo "init container"
# set container's time zone
cp "/usr/share/zoneinfo/${TIME_ZONE}" /etc/localtime
echo "${TIME_ZONE}" >/etc/timezone
echo "set timezone ${TIME_ZONE} ($(date))"
# set UID & GID for the app
if [ "${APP_UID}" ] || [ "${APP_GID}" ]; then
[ "${APP_UID}" ] || APP_UID="1001"
[ "${APP_GID}" ] || APP_GID="${APP_UID}"
echo "set custom APP_UID=${APP_UID} & APP_GID=${APP_GID}"
sed -i "s/^app:x:1001:1001:/app:x:${APP_UID}:${APP_GID}:/" /etc/passwd
sed -i "s/^app:x:1001:/app:x:${APP_GID}:/" /etc/group
else
echo "custom APP_UID and/or APP_GID not defined, using 1001:1001"
fi
chown -R app:app /srv /home/app
fi
echo "prepare environment"
# replace {% REMARK_URL %} by content of REMARK_URL variable
find /srv -regex '.*\.\(html\|js\|mjs\)$' -print \
-exec sed -i "s|{% REMARK_URL %}|${REMARK_URL}|g" {} \;
if [ -n "${SITE_ID}" ]; then
#replace "site_id: 'remark'" by SITE_ID
sed -i "s|'remark'|'${SITE_ID}'|g" /srv/web/*.html
fi
echo "execute \"$*\""
if [ "${uid}" -eq "0" ]; then
exec su-exec app "$@"
else
exec "$@"
fi