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
+2 -2
View File
@@ -9,7 +9,7 @@ RUN apt-get update && \
apt-get upgrade -y
RUN groupadd -g $DBEAVER_GID dbeaver && \
useradd -g $DBEAVER_GID -M -u $DBEAVER_UID -s /bin/bash dbeaver
useradd -g $DBEAVER_GID -m -u $DBEAVER_UID -s /bin/bash dbeaver
COPY cloudbeaver /opt/cloudbeaver
COPY scripts/launch-product.sh /opt/cloudbeaver/launch-product.sh
@@ -20,4 +20,4 @@ WORKDIR /opt/cloudbeaver/
RUN chmod +x "run-server.sh" "/opt/cloudbeaver/launch-product.sh"
ENTRYPOINT ["./run-server.sh"]
ENTRYPOINT ["./launch-product.sh"]
+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