feat: add PUID PGID UMASK settings to image

This commit is contained in:
DDSRem 2023-06-16 11:41:29 +08:00
parent 77b030199e
commit e6715081dd
2 changed files with 48 additions and 7 deletions

View file

@ -14,19 +14,24 @@ RUN apk update && \
apk add --no-cache --update \
curl \
tzdata \
ffmpeg
ffmpeg \
bash \
jq \
shadow \
su-exec \
dumb-init && \
usermod --shell /bin/bash node && \
rm -rf /var/cache/apk/*
COPY --from=tone /usr/local/bin/tone /usr/local/bin/
COPY --from=build /client/dist /client/dist
COPY index.js package* /
COPY server server
COPY --chmod=755 entrypoint.sh /entrypoint.sh
RUN npm ci --only=production
EXPOSE 80
HEALTHCHECK \
--interval=30s \
--timeout=3s \
--start-period=10s \
CMD curl -f http://127.0.0.1/healthcheck || exit 1
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["node", "index.js"]
EXPOSE 80

36
entrypoint.sh Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash
UMASK=${UMASK:-022}
PUID=${PUID:-1000}
PGID=${PGID:-1000}
umask ${UMASK}
if [ ! -d /config ]; then
mkdir /config
fi
if [ ! -d /metadata ]; then
mkdir /metadata
fi
if [ ! -d /audiobooks ]; then
mkdir /audiobooks
fi
if [ ! -d /podcasts ]; then
mkdir /podcasts
fi
echo "Change owner to user AudioBookShelf..."
echo "PUID=${PUID}"
echo "PGID=${PGID}"
groupmod -o -g ${PGID} node
usermod -o -u ${PUID} node
chown -R node:node \
/config \
/metadata
chown node:node \
/audiobooks \
/podcasts
exec su-exec node:node dumb-init $*