Skip to content
Snippets Groups Projects
Commit 4a4cd0ba authored by Griefed's avatar Griefed :joystick:
Browse files

refactor: Switch ARGs, provide defaults, add aliases. Basically, merge the...

refactor: Switch ARGs, provide defaults, add aliases. Basically, merge the three dockerfiles into one.
parent 503e8b55
No related branches found
No related tags found
No related merge requests found
FROM alpine:3.11 as rootfs-stage FROM alpine:3.14 as fetcher
# Ubuntu focal architecture
ARG FOCAL_ARCH="amd64"
ARG FOCAL_RELEASE_DATE="current"
# environment
ENV REL=focal
ENV ARCH=amd64
# install packages
RUN \ RUN \
apk add --no-cache \ apk add --no-cache \
bash \ bash \
curl \ curl \
tzdata \ tzdata \
xz xz
# grab base tarball
RUN \ RUN \
mkdir /root-out && \ mkdir /focal-rootfs && \
curl -o \ curl -o \
/rootfs.tar.gz -L \ /focal-rootfs.tar.gz -L \
https://partner-images.canonical.com/core/${REL}/current/ubuntu-${REL}-core-cloudimg-${ARCH}-root.tar.gz && \ https://partner-images.canonical.com/core/focal/${FOCAL_RELEASE_DATE}/ubuntu-focal-core-cloudimg-${FOCAL_ARCH}-root.tar.gz && \
tar xf \ tar xf \
/rootfs.tar.gz -C \ /focal-rootfs.tar.gz -C \
/root-out /focal-rootfs
# Runtime stage
FROM scratch FROM scratch
COPY --from=rootfs-stage /root-out/ /
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="TheLamer"
# set version for s6 overlay COPY --from=fetcher /focal-rootfs/ /
ARG OVERLAY_VERSION="v2.2.0.3"
ARG OVERLAY_ARCH="amd64" ARG BUILD_DATE="PassMeTheDateMate"
ARG VERSION="ChangeMe"
LABEL build_version="Git.Griefed.de version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="Griefed <griefed@griefed.de>"
LABEL description="Original baseimage by Linuxserver.io. Changed to fit the needs of Griefed.de \
This fork was mainly created because I wanted to gather experience in writing \
my own baseimage. Linuxserver.io provide top quality images with great complexity, making \
them perfect for learning."
# add s6 overlay # s6, s6 version and s6 architecture
ARG OVERLAY_ARCH="amd64"
ARG OVERLAY_VERSION="v2.2.0.3"
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/ ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
COPY patch/ /tmp/patch COPY patch/ /tmp/patch
# set environment variables # set environment variables
ARG DEBIAN_FRONTEND="noninteractive" ARG DEBIAN_FRONTEND="noninteractive"
ENV HOME="/root" \ ENV HOME="/root"
LANGUAGE="en_US.UTF-8" \ ENV LANGUAGE="en_US.UTF-8"
LANG="en_US.UTF-8" \ ENV LANG="en_US.UTF-8"
TERM="xterm" ENV TERM="xterm"
# copy sources # copy sources
COPY sources.list /etc/apt/ COPY sources.list /etc/apt/
COPY sources.list.arm /etc/apt
RUN \
if [ $OVERLAY_ARCH="amd64" ];then
rm /etc/apt/sources.list.arm
else
rm /etc/apt/sources.list
fi
RUN \ RUN \
echo "**** Ripped from Ubuntu Docker Logic ****" && \ echo "**** Ripped from Ubuntu Docker Logic ****" && \
set -xe && \ set -xe && \
echo '#!/bin/sh' \ echo '#!/bin/sh' \
> /usr/sbin/policy-rc.d && \ > /usr/sbin/policy-rc.d && \
echo 'exit 101' \ echo 'exit 101' \
>> /usr/sbin/policy-rc.d && \ >> /usr/sbin/policy-rc.d && \
chmod +x \ chmod +x \
/usr/sbin/policy-rc.d && \ /usr/sbin/policy-rc.d && \
dpkg-divert --local --rename --add /sbin/initctl && \ dpkg-divert --local --rename --add /sbin/initctl && \
cp -a \ cp -a \
/usr/sbin/policy-rc.d \ /usr/sbin/policy-rc.d \
/sbin/initctl && \ /sbin/initctl && \
sed -i \ sed -i \
's/^exit.*/exit 0/' \ 's/^exit.*/exit 0/' \
/sbin/initctl && \ /sbin/initctl && \
echo 'force-unsafe-io' \ echo 'force-unsafe-io' \
> /etc/dpkg/dpkg.cfg.d/docker-apt-speedup && \ > /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"; };' \ 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 && \ > /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"; };' \ 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 && \ >> /etc/apt/apt.conf.d/docker-clean && \
echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' \ echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' \
>> /etc/apt/apt.conf.d/docker-clean && \ >> /etc/apt/apt.conf.d/docker-clean && \
echo 'Acquire::Languages "none";' \ echo 'Acquire::Languages "none";' \
> /etc/apt/apt.conf.d/docker-no-languages && \ > /etc/apt/apt.conf.d/docker-no-languages && \
echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' \ echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' \
> /etc/apt/apt.conf.d/docker-gzip-indexes && \ > /etc/apt/apt.conf.d/docker-gzip-indexes && \
echo 'Apt::AutoRemove::SuggestsImportant "false";' \ echo 'Apt::AutoRemove::SuggestsImportant "false";' \
> /etc/apt/apt.conf.d/docker-autoremove-suggests && \ > /etc/apt/apt.conf.d/docker-autoremove-suggests && \
mkdir -p /run/systemd && \ mkdir -p /run/systemd && \
echo 'docker' \ echo 'docker' \
> /run/systemd/container && \ > /run/systemd/container && \
echo "**** install apt-utils and locales ****" && \ echo "**** Install apt-utils and locales ****" && \
apt-get update && \ apt-get update && \
apt-get install -y \ apt-get install -y \
apt-utils \ apt-utils \
locales && \ locales && \
echo "**** install packages ****" && \ echo "**** Install packages ****" && \
apt-get install -y \ apt-get install -y \
curl \ curl \
gnupg \ gnupg \
patch \ patch \
tzdata && \ tzdata && \
echo "**** generate locale ****" && \ echo "**** Generate locale ****" && \
locale-gen en_US.UTF-8 && \ locale-gen en_US.UTF-8 && \
echo "**** create abc user and make our folders ****" && \ echo "**** Create abc user and make our folders ****" && \
useradd -u 911 -U -d /config -s /bin/false abc && \ useradd -u 911 -U -d /config -s /bin/false abc && \
usermod -G users abc && \ usermod -G users abc && \
mkdir -p \ mkdir -p \
/app \ /app \
/config \ /config \
/defaults && \ /data \
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \ /defaults && \
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \ mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
echo "**** cleanup ****" && \ patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
apt-get remove -y patch && \ echo "**** Create our bash-aliases ****" && \
apt-get autoremove && \ alias ll="LC_COLLATE=C ls -ahl --group-directories-first --color=auto" && \
apt-get clean && \ alias ..="cd .." && \
rm -rf \ echo "**** Cleanup ****" && \
/tmp/* \ apt-get remove -y patch && \
/var/lib/apt/lists/* \ apt-get autoremove && \
/var/tmp/* apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
# add local files # add local files
COPY root/ / COPY root/ /
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment