mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Added a custom docker entrypoint which chowns used volumes
This fixes issue #206.
This commit is contained in:
parent
f0947fd948
commit
6f28029fb8
2 changed files with 50 additions and 2 deletions
43
.docker/partdb-entrypoint.sh
Normal file
43
.docker/partdb-entrypoint.sh
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
#
|
||||
# Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# recursive chowns can take a while, so we'll just do it if the owner is wrong
|
||||
|
||||
# Chown uploads/ folder if it does not belong to www-data
|
||||
if [ "$(stat -c '%u' /var/www/html/uploads)" != "$(id -u www-data)" ]; then
|
||||
chown -R www-data:www-data /var/www/html/uploads
|
||||
fi
|
||||
|
||||
# Do the same for the public/media folder
|
||||
if [ "$(stat -c '%u' /var/www/html/public/media)" != "$(id -u www-data)" ]; then
|
||||
chown -R www-data:www-data /var/www/html/public/media
|
||||
fi
|
||||
|
||||
# If var/db/ folder exists, do the same for it
|
||||
if [ -d /var/www/html/var/db ]; then
|
||||
if [ "$(stat -c '%u' /var/www/html/var/db)" != "$(id -u www-data)" ]; then
|
||||
chown -R www-data:www-data /var/www/html/var/db
|
||||
fi
|
||||
fi
|
||||
|
||||
# Pass to the original entrypoint
|
||||
exec "$@"
|
Loading…
Add table
Add a link
Reference in a new issue