Merge pull request #787 from kiwix/better-deal-with-data-dir-permissions

Better deal with container /data dir permissions
This commit is contained in:
Kelson
2025-12-01 10:51:36 +01:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -10,7 +10,8 @@ VOLUME /data
WORKDIR /data
# running as a named unprivileged user
RUN addgroup -S user && adduser -S user -G user
RUN addgroup -S -g 1001 user && adduser -S -u 1001 user -G user
RUN chown user:user /data
USER user
COPY ./start.sh /usr/local/bin/

View File

@@ -3,6 +3,14 @@
# Download if necessary a file
if [ ! -z "$DOWNLOAD" ]
then
# Check if /data is writable
if [ ! -w /data ]
then
echo "'/data' directory is not writable by '$(id -n -u):$(id -n -g)' ($(id -u):$(id -g)). ZIM file(s) can not be written."
exit 1
fi
# Dwonload ZIM file
ZIM=`basename $DOWNLOAD`
wget $DOWNLOAD -O "$ZIM"