mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-27 21:24:16 -04:00
Added entrypoint to fix permission errors
This commit is contained in:
parent
15c1cb39e9
commit
63909f6176
2 changed files with 20 additions and 5 deletions
18
bin/entrypoint.sh
Executable file
18
bin/entrypoint.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# detect userid:groupid of contents of data folder
|
||||
DATA_DIR="${DATA_DIR:-/data}"
|
||||
ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}"
|
||||
|
||||
# Autodetect UID and GID of host user based on ownership of files in the volume
|
||||
USID=$(stat --format="%u" "$DATA_DIR")
|
||||
GRID=$(stat --format="%g" "$DATA_DIR")
|
||||
COMMAND="$@"
|
||||
|
||||
# run django as the host user's uid:gid so that any files touched have the same permissions as outside the container
|
||||
# e.g. ./manage.py runserver
|
||||
|
||||
chown "$USID":"$GRID" "$DATA_DIR"
|
||||
usermod -u $USID $ARCHIVEBOX_USER
|
||||
groupmod -g $GRID $ARCHIVEBOX_USER
|
||||
gosu $ARCHIVEBOX_USER bash -c "$COMMAND"
|
Loading…
Add table
Add a link
Reference in a new issue