Skip to content

Commit

Permalink
Devops#1553 root user fix (#3087)
Browse files Browse the repository at this point in the history
* Reapply "dbeaver/dbeaver-devops#1553 Added user dbeaver in dockerfile cloudbeaver (#3067)"

This reverts commit a36a555.

* dbeaver/dbeaver-devops#1553 updated base-java image with user

* dbeaver/dbeaver-devops#1553 fixed user usage and ownership applying

* dbeaver/dbeaver-devops#1553 changed  GID UID

* dbeaver/dbeaver-devops#1553 desc of chowner fixed

* dbeaver/dbeaver-devops#1553 fixed user creation

* dbeaver/dbeaver-devops#1553 Added creating dbeaver user in ce dockerfile

* dbeaver/dbeaver-devops#1553 Removed comment

* dbeaver/dbeaver-devops#1553 Removed comment

* dbeaver/dbeaver-devops#1553 Rewrited comment

* dbeaver/dbeaver-devops#1553 Replaced UID on user name

---------

Co-authored-by: Greg Miller <[email protected]>
Co-authored-by: Mikhailov Grigorii <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent cd901b9 commit ae1f0b7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
3 changes: 1 addition & 2 deletions deploy/docker/base-java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ RUN set -eux; \
tzdata \
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
locales \
nano \
; \
nano && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen en_US.UTF-8; \
rm -rf /var/lib/apt/lists/*
Expand Down
20 changes: 16 additions & 4 deletions deploy/docker/cloudbeaver-ce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@ FROM dbeaver/base-java

MAINTAINER DBeaver Corp, [email protected]

RUN apt-get update; \
apt-get upgrade -y;

ENV DBEAVER_GID=8978
ENV DBEAVER_UID=8978

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

COPY cloudbeaver /opt/cloudbeaver
COPY scripts/launch-product.sh /opt/cloudbeaver/launch-product.sh

RUN chown -R $DBEAVER_UID:$DBEAVER_GID /opt/cloudbeaver

EXPOSE 8978
RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \;
WORKDIR /opt/cloudbeaver/
ENTRYPOINT ["./run-server.sh"]

RUN chmod +x "run-server.sh" "/opt/cloudbeaver/launch-product.sh"

ENTRYPOINT ["./launch-product.sh"]
11 changes: 11 additions & 0 deletions deploy/scripts/launch-product.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# This script is needed to change ownership and run the application as user dbeaver during the upgrade from version 24.2.0

# 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"

0 comments on commit ae1f0b7

Please sign in to comment.