78 lines
3.3 KiB
Docker
78 lines
3.3 KiB
Docker
# syntax=docker/dockerfile:1
|
|
ARG BUILD_BASE_IMAGE
|
|
FROM ${BUILD_BASE_IMAGE}
|
|
|
|
ARG BUILD_APP_VERSION
|
|
ARG BUILD_S6_ARCH_amd64
|
|
ARG BUILD_S6_OVERLAY_VERSION
|
|
ARG BUILD_DATE
|
|
ARG MODS_VERSION="v3"
|
|
ARG PKG_INST_VERSION="v1"
|
|
ARG LSIOWN_VERSION="v1"
|
|
ARG WITHCONTENV_VERSION="v1"
|
|
ARG BUILD_APP_USER
|
|
ARG BUILD_APP_UID
|
|
ARG BUILD_APP_GID
|
|
ARG BUILD_MAINTAINER
|
|
|
|
LABEL build_version="${BUILD_MAINTAINER} version: ${BUILD_APP_VERSION} Build-date:- ${BUILD_DATE}"
|
|
LABEL maintainer="${BUILD_MAINTAINER}"
|
|
|
|
# 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 && \
|
|
microdnf clean all
|
|
|
|
# add s6 overlay
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-${BUILD_S6_ARCH_amd64}.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-${BUILD_S6_ARCH_amd64}.tar.xz
|
|
|
|
# add s6 optional symlinks
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz && unlink /usr/bin/with-contenv
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
|
|
|
|
# LSIO Mods Integration
|
|
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods"
|
|
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
|
|
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
|
|
ADD --chmod=755 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/with-contenv.${WITHCONTENV_VERSION}" "/usr/bin/with-contenv"
|
|
|
|
# set environment variables
|
|
ENV HOME="/root" \
|
|
LANGUAGE="de_DE.UTF-8" \
|
|
LANG="de_DE.UTF-8" \
|
|
TERM="xterm" \
|
|
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
|
|
S6_VERBOSITY=1 \
|
|
S6_STAGE2_HOOK=/docker-mods \
|
|
VIRTUAL_ENV=/lsiopy \
|
|
PATH="/lsiopy/bin:$PATH"
|
|
|
|
# 2. Pakete installieren
|
|
RUN echo "**** install packages ****" && \
|
|
microdnf install -y --nodocs \
|
|
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
|
|
|
|
# 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
|
|
RUN tar -C / -Jxpf /tmp/stable.tar.gz && rm -rf /tmp/stable.tar.gz
|
|
RUN find /etc/s6-overlay/s6-rc.d/ -type f \( -name "run" -o -name "up" \) -exec chmod +x {} +
|
|
|
|
ENTRYPOINT ["/init"] |