diff --git a/Dockerfile b/Dockerfile index bea3556..5a3c773 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,13 +18,12 @@ ARG BUILD_MAINTAINER LABEL build_version="${BUILD_MAINTAINER} version: ${BUILD_APP_VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="${BUILD_MAINTAINER}" -# RHEL nutzt microdnf. Wir installieren xz (für tar) und shadow-utils (für useradd) -RUN microdnf update -y && \ +# 1. EPEL und Basis-Tools (shadow-utils ist kritisch für useradd!) +RUN microdnf install -y --nodocs \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ + microdnf update -y && \ microdnf install -y --nodocs \ - xz \ - tar \ - shadow-utils \ - tzdata && \ + xz tar shadow-utils tzdata && \ microdnf clean all # add s6 overlay @@ -56,21 +55,20 @@ ENV HOME="/root" \ VIRTUAL_ENV=/lsiopy \ PATH="/lsiopy/bin:$PATH" -RUN echo "**** install packages and locales ****" && \ +# 2. Pakete installieren +RUN echo "**** install packages ****" && \ microdnf install -y --nodocs \ - glibc-langpack-de \ - curl \ - jq \ - nmap-ncat \ - cronie && \ - echo "**** create user and folders ****" && \ - # In RHEL prüfen wir, ob die Gruppe existiert, bevor wir sie anlegen - groupadd -g ${BUILD_APP_GID} ${BUILD_APP_USER} || true && \ + glibc-all-langpacks \ + curl jq nmap-ncat cronie && \ + microdnf clean all + +# 3. User und Verzeichnisse (getrennt vom Paket-Install!) +RUN echo "**** create user and folders ****" && \ + if ! getent group ${BUILD_APP_GID} >/dev/null; then \ + groupadd -g ${BUILD_APP_GID} ${BUILD_APP_USER}; \ + fi && \ useradd -u ${BUILD_APP_UID} -g ${BUILD_APP_GID} -d /config -s /bin/false ${BUILD_APP_USER} && \ - mkdir -p /app /config /defaults /lsiopy && \ - echo "**** cleanup ****" && \ - microdnf clean all && \ - rm -rf /tmp/* /var/tmp/* + mkdir -p /app /config /defaults /lsiopy # 7. Lokale Skripte kopieren und Ausführungsrechte für S6 reparieren ADD https://git.pi-farm.de/pi-farm/s6-overlay/archive/stable.tar.gz /tmp diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 5f6456f..55aec12 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -17,15 +17,12 @@ ARG BUILD_MAINTAINER LABEL build_version="${BUILD_MAINTAINER} version: ${BUILD_APP_VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="${BUILD_MAINTAINER}" -# 1. EPEL Repository und Grundpakete für RHEL/UBI installieren +# 1. EPEL und Basis-Tools (shadow-utils ist kritisch für useradd!) RUN microdnf install -y --nodocs \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ microdnf update -y && \ microdnf install -y --nodocs \ - xz \ - tar \ - shadow-utils \ - tzdata && \ + xz tar shadow-utils tzdata && \ microdnf clean all # 2. S6 Overlay hinzufügen (explizit für aarch64) @@ -56,21 +53,20 @@ ENV HOME="/root" \ VIRTUAL_ENV=/lsiopy \ PATH="/lsiopy/bin:$PATH" -# 6. Restliche Pakete (aus EPEL & UBI), User und Ordner anlegen -RUN echo "**** install packages and locales ****" && \ +# 2. Pakete installieren +RUN echo "**** install packages ****" && \ microdnf install -y --nodocs \ - glibc-langpack-de \ - curl \ - jq \ - nmap-ncat \ - cronie && \ - echo "**** create abc user and make our folders ****" && \ - groupadd -g ${BUILD_APP_GID} ${BUILD_APP_USER} || true && \ + glibc-all-langpacks \ + curl jq nmap-ncat cronie && \ + microdnf clean all + +# 3. User und Verzeichnisse (getrennt vom Paket-Install!) +RUN echo "**** create user and folders ****" && \ + if ! getent group ${BUILD_APP_GID} >/dev/null; then \ + groupadd -g ${BUILD_APP_GID} ${BUILD_APP_USER}; \ + fi && \ useradd -u ${BUILD_APP_UID} -g ${BUILD_APP_GID} -d /config -s /bin/false ${BUILD_APP_USER} && \ - mkdir -p /app /config /defaults /lsiopy && \ - echo "**** cleanup ****" && \ - microdnf clean all && \ - rm -rf /tmp/* /var/tmp/* + mkdir -p /app /config /defaults /lsiopy # 7. Lokale Skripte kopieren und Ausführungsrechte für S6 reparieren ADD https://git.pi-farm.de/pi-farm/s6-overlay/archive/stable.tar.gz /tmp