Change UID and GID of owner users

This commit is contained in:
Victor Carlos Erenu
2026-05-12 21:04:22 +07:00
parent 388b2c2225
commit c137354203
6 changed files with 55 additions and 38 deletions
+8 -5
View File
@@ -38,25 +38,28 @@ RUN curl --fail --silent -L \
################################################################################
FROM amazonlinux:2023
ARG WAZUH_UID=101
ARG WAZUH_GID=101
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Install only runtime dependencies
RUN dnf install procps shadow-utils -y && \
dnf clean all && \
getent group wazuh || groupadd -r -g 999 wazuh && \
getent group wazuh || groupadd -r -g ${WAZUH_GID} wazuh && \
getent passwd wazuh || useradd --system \
--uid 999 \
--no-create-home \
--home-dir /var/ossec \
--gid wazuh \
--uid ${WAZUH_UID} \
--gid ${WAZUH_GID} \
--shell /sbin/nologin \
wazuh
# Copy Wazuh Agent installation from builder
COPY --from=builder /var/ossec /var/ossec
COPY --from=builder --chown=${WAZUH_UID}:${WAZUH_GID} /var/ossec /var/ossec
# Copy tini static binary
COPY --from=builder /usr/local/bin/tini /usr/local/bin/tini
COPY --from=builder --chown=${WAZUH_UID}:${WAZUH_GID} /usr/local/bin/tini /usr/local/bin/tini
# Copy entrypoint and init scripts
COPY config/entrypoint.sh /entrypoint.sh