dbeaver/dbeaver-devops#1630 Added if for root and non-root users (#3180)

* dbeaver/dbeaver-devops#1630 Added if for root and non-root users

* dbeaver/dbeaver-devops#1630 Added creating dir /home/dbeaver

---------

Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
Mikhailov Grigorii
2025-01-27 11:26:21 +01:00
committed by GitHub
co-authored by Daria Marutkina
parent 3ceac40016
commit 529186df41
2 changed files with 13 additions and 5 deletions
+11 -3
View File
@@ -5,7 +5,15 @@
# Change ownership of the WORKDIR to the dbeaver user and group
# Variables DBEAVER_<UID|GID> are defined in the Dockerfile and exported to the runtime environment
# PWD equals WORKDIR value from product Dockerfile
chown -R $DBEAVER_UID:$DBEAVER_GID $PWD
# Execute run-server.sh as the dbeaver user with the JAVA_HOME and PATH environment variables
exec su dbeaver -c "JAVA_HOME=$JAVA_HOME PATH=$PATH ./run-server.sh"
if [ "$(id -u)" -eq 0 ]; then
TARGET_USER=${TARGET_USER:-dbeaver}
TARGET_UID=${TARGET_UID:-$DBEAVER_UID}
TARGET_GID=${TARGET_GID:-$DBEAVER_GID}
chown -R $DBEAVER_UID:$DBEAVER_GID $PWD
# Execute run-server.sh as the dbeaver user with the JAVA_HOME and PATH environment variables
exec su "$TARGET_USER" -c "JAVA_HOME=$JAVA_HOME PATH=$PATH ./run-server.sh"
else
exec ./run-server.sh
fi