This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 0654007bd5 Explicitly add user GID and UID to docker scripts, fixes 
#6031 (#6032)
0654007bd5 is described below

commit 0654007bd550db48f2decfe42bca19dcaf5790f0
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Tue Nov 18 16:17:42 2025 +0100

    Explicitly add user GID and UID to docker scripts, fixes #6031 (#6032)
---
 docker/Dockerfile     | 44 +++++++++++++++++---------------------------
 docker/Dockerfile.web | 12 +++++++-----
 2 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 0fb8c10721..9bf4a645eb 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -17,6 +17,10 @@
 
 FROM alpine
 LABEL maintainer="Apache Hop Team"
+# The UID for the created user
+ARG HOP_UID=501
+# The GID for the created user
+ARG HOP_GID=501
 # path to where the artifacts should be deployed to
 ENV DEPLOYMENT_PATH=/opt/hop
 # volume mount point
@@ -82,36 +86,22 @@ ENV HOP_SERVER_MAX_OBJECT_TIMEOUT=
 # We want to run hop-config with these options:
 ENV HOP_CONFIG_OPTIONS=
 
-# Define en_US.
-# ENV LANGUAGE en_US.UTF-8
-# ENV LANG en_US.UTF-8
-# ENV LC_ALL en_US.UTF-8
-# ENV LC_CTYPE en_US.UTF-8
-# ENV LC_MESSAGES en_US.UTF-8
-
-# Give the /tmp folder some breathing room
-#
-RUN chmod 777 -R /tmp && chmod o+t -R /tmp
-
-# Install some fonts
-RUN apk --no-cache add openjdk17-jre \
-        msttcorefonts-installer \
-        fontconfig && \
-        update-ms-fonts && \
-        fc-cache -f
-
 # INSTALL REQUIRED PACKAGES AND ADJUST LOCALE
 # procps: The package includes the programs ps, top, vmstat, w, kill, free, 
slabtop, and skill
+RUN addgroup -g ${HOP_GID} -S hop \
+    && adduser -u ${HOP_UID} -S -D -G hop hop \
+    && chmod 777 -R /tmp && chmod o+t -R /tmp \
+    && apk update \
+    && apk --no-cache add bash curl fontconfig msttcorefonts-installer 
openjdk17-jre procps \
+    && update-ms-fonts \
+    && fc-cache -f \
+    && rm -rf /var/cache/apk/* \
+    && mkdir ${DEPLOYMENT_PATH} \
+    && mkdir ${VOLUME_MOUNT_POINT} \
+    && chown hop:hop ${DEPLOYMENT_PATH} \
+    && chown hop:hop ${VOLUME_MOUNT_POINT}
 
 
-RUN apk update \
-  && apk add --no-cache bash curl procps \
-  && rm -rf /var/cache/apk/* \
-  && mkdir ${DEPLOYMENT_PATH} \
-  && mkdir ${VOLUME_MOUNT_POINT} \
-  && adduser -D -s /bin/bash -h /home/hop hop \
-  && chown hop:hop ${DEPLOYMENT_PATH} \
-  && chown hop:hop ${VOLUME_MOUNT_POINT}
 
 
 # copy the hop package from the local resources folder to the container image 
directory
@@ -127,5 +117,5 @@ VOLUME ["/files"]
 USER hop
 ENV PATH=$PATH:${DEPLOYMENT_PATH}/hop
 WORKDIR /home/hop
-# CMD ["/bin/bash"]
+
 ENTRYPOINT ["/bin/bash", "/opt/hop/run.sh"]
diff --git a/docker/Dockerfile.web b/docker/Dockerfile.web
index 85f56b1c90..c0e353b562 100644
--- a/docker/Dockerfile.web
+++ b/docker/Dockerfile.web
@@ -18,6 +18,10 @@
 
 FROM tomcat:9-jdk17
 LABEL maintainer="Apache Hop Team"
+# The UID for the created user
+ARG HOP_UID=501
+# The GID for the created user
+ARG HOP_GID=501
 # path to where the artifacts should be deployed to
 ENV DEPLOYMENT_PATH=/usr/local/tomcat/webapps/ROOT
 ENV HOP_AES_ENCODER_KEY=""
@@ -59,11 +63,9 @@ ENV CATALINA_OPTS='${HOP_OPTIONS} \
   -DHOP_GUI_ZOOM_FACTOR="${HOP_GUI_ZOOM_FACTOR}"'
 
 # Create Hop user
-RUN groupadd -r hop -g 501
-RUN useradd -d /home/hop -u 501 -m -s /bin/bash -g hop hop
-
-# Cleanup and create folder
-RUN rm -rf webapps/* \
+RUN groupadd -r hop -g ${HOP_GID} \
+    && useradd -d /home/hop -u ${HOP_UID} -m -s /bin/bash -g hop hop \
+    && rm -rf webapps/* \
     && mkdir "${CATALINA_HOME}"/webapps/ROOT \
     && mkdir "${HOP_AUDIT_FOLDER}"
 

Reply via email to