This commit is contained in:
142
Dockerfile
142
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"]
|
||||
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"]
|
||||
Reference in New Issue
Block a user