From 920b9d02f20a01f25875f24203d03b3ce5ea5f83 Mon Sep 17 00:00:00 2001 From: "user.name pi-farm" Date: Mon, 16 Mar 2026 12:06:35 +0100 Subject: [PATCH] trixie-slim --- Dockerfile | 142 +++++++++++++++++++++++++++++++++++++++++++++++--- buildargs.env | 30 ++++++----- 2 files changed, 150 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07bb5b9..f115c74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Example Dockerfile for amd64 -ARG BASE_IMAGE=alpine:latest +ARG BASE_IMAGE=${BUILD_BASE_IMAGE} FROM ${BASE_IMAGE} @@ -14,14 +14,140 @@ LABEL org.opencontainers.image.title="${APP_NAME}" ENV TZ=${TZ} ENV USER=${APP_USER} -RUN apk add --no-cache tzdata ca-certificates +RUN apt-get update && \ + apt install --no-cache \ + tzdata \ + xz -WORKDIR /app -COPY ./config /app/config -COPY ./data /app/data +# 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 /root-out -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 /root-out -Jxpf /tmp/s6-overlay-${BUILD_S6_ARCH_amd64}.tar.xz -RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app +# 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 /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz && unlink /root-out/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 /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz -USER ${APP_USER} +ARG BUILD_DATE +ARG BUILD_APP_VERSION +ARG MODS_VERSION="v3" +ARG PKG_INST_VERSION="v1" +ARG LSIOWN_VERSION="v1" +ARG WITHCONTENV_VERSION="v1" +ARG BUILD_APP_GID +ARG BUILD_APP_USER +ARG BUILD_MAINTAINER +LABEL build_version="${BUILD_MAINTAINER} version: ${BUILD_APP_VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="${BUILD_MAINTAINER}" -CMD ["sh"] \ No newline at end of file +ADD --chmod=755 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods" +ADD --chmod=755 "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=755 "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 +ARG DEBIAN_FRONTEND="noninteractive" +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" + +# environment variables +ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ + HOME="/root" \ + TERM="xterm" \ + S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \ + S6_VERBOSITY=1 \ + S6_STAGE2_HOOK=/docker-mods \ + VIRTUAL_ENV=/lsiopy \ + PATH="/lsiopy/bin:$PATH" + +RUN \ + echo "**** Ripped from Ubuntu Docker Logic ****" && \ + echo '#!/bin/sh' \ + > /usr/sbin/policy-rc.d && \ + echo 'exit 101' \ + >> /usr/sbin/policy-rc.d && \ + chmod +x \ + /usr/sbin/policy-rc.d && \ + dpkg-divert --local --rename --add /sbin/initctl && \ + cp -a \ + /usr/sbin/policy-rc.d \ + /sbin/initctl && \ + sed -i \ + 's/^exit.*/exit 0/' \ + /sbin/initctl && \ + echo 'force-unsafe-io' \ + > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup && \ + echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' \ + > /etc/apt/apt.conf.d/docker-clean && \ + echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' \ + >> /etc/apt/apt.conf.d/docker-clean && \ + echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' \ + >> /etc/apt/apt.conf.d/docker-clean && \ + echo 'Acquire::Languages "none";' \ + > /etc/apt/apt.conf.d/docker-no-languages && \ + echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' \ + > /etc/apt/apt.conf.d/docker-gzip-indexes && \ + echo 'Apt::AutoRemove::SuggestsImportant "false";' \ + > /etc/apt/apt.conf.d/docker-autoremove-suggests && \ + mkdir -p /run/systemd && \ + echo 'docker' \ + > /run/systemd/container && \ + echo "**** install apt-utils and locales ****" && \ + apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + apt-utils \ + locales && \ + echo "**** install packages ****" && \ + apt-get install -y \ + catatonit \ + cron \ + curl \ + gnupg \ + jq \ + netcat-traditional \ + tzdata && \ + echo "**** add all sources ****" && \ + echo "deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware" > /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian trixie-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://deb.debian.org/debian trixie-backports main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb http://security.debian.org/debian-security/ trixie-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + echo "deb-src http://security.debian.org/debian-security/ trixie-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list && \ + rm -f /etc/apt/sources.list.d/debian.sources && \ + echo "**** generate locale ****" && \ + locale-gen en_US.UTF-8 && \ + echo "**** create abc user and make our folders ****" && \ + useradd -u ${BUILD_APP_UID} -U -d /config -s /bin/false ${USER} && \ + usermod -G users ${USER} && \ + mkdir -p \ + /app \ + /config \ + /defaults \ + /lsiopy && \ + echo "**** cleanup ****" && \ + apt-get -y autoremove && \ + apt-get clean && \ + rm -rf \ + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* \ + /var/log/* \ + /usr/share/man + +# add local files +COPY root/ / + +ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/buildargs.env b/buildargs.env index dad5f2a..a1eb657 100644 --- a/buildargs.env +++ b/buildargs.env @@ -1,19 +1,20 @@ ## BUILD STAGE -BUILD_TAG=1.00 -BUILD_BASE_IMAGE=alpine:${BUILD_TAG} +BUILD_BASE_TAG=trixie-slim +BUILD_BASE_IMAGE=debian:${BUILD_TAG} ## Examples for BUILD_BASE_IMAGE # alpine:${BUILD_TAG} # git.pi-farm.de/pi-farm/docker-baseimage-alpine:v${BUILD_TAG} -#BUILD_ALPINE_ARCH_AMD64=x86_64 -#BUILD_ALPINE_ARCH_AARCH64=aarch64 -#BUILD_S6_ARCH_amd64=x86_64 -#BUILD_S6_ARCH_aarch64=aarch64 -#BUILD_S6_OVERLAY_VERSION=3.2.0.2 -#BUILD_MAINTAINER=pi-farm -#BUILD_APP_VERSION=v${BUILD_TAG} -#BUILD_APP_NAME=basimage-alpine -#BUILD_APP_USER=pi -#BUILD_APP_GID=1000 +BUILD_ALPINE_ARCH_AMD64=x86_64 +BUILD_ALPINE_ARCH_AARCH64=aarch64 +BUILD_S6_ARCH_amd64=x86_64 +BUILD_S6_ARCH_aarch64=aarch64 +BUILD_S6_OVERLAY_VERSION=3.2.2.0 +BUILD_MAINTAINER=pi-farm +BUILD_APP_VERSION=v${BUILD_BASE_TAG} +BUILD_APP_NAME=baseimage-debian +BUILD_APP_USER=pi +BUILD_APP_UID=1000 +BUILD_APP_GID=1000 ## ENV STAGE ENV_TZ=Europe/Berlin ENV_PUID=1000 @@ -21,6 +22,7 @@ ENV_PGID=1000 # VOL_CONFIG=./config:/config # VOL_DATA=./data:/data # PORT_WEB=8080:80 -#PUSH=gitea,dockerhub -DESCRIPTION="Example example example" +PUSH=gitea +#,dockerhub +DESCRIPTION="This is a debian based image with s6-overlay.\nBased on the great work of Linuxserver.io"