Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions images/build/debian-base/trixie/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM scratch

ADD rootfs.tar /

CMD ["/bin/sh"]
100 changes: 100 additions & 0 deletions images/build/debian-base/trixie/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG BASEIMAGE

FROM $BASEIMAGE AS certs

ENV DEBIAN_FRONTEND=noninteractive

# Install ca-certificates and dependencies
RUN apt-get update \
&& apt-get install -y ca-certificates

FROM $BASEIMAGE

ENV DEBIAN_FRONTEND=noninteractive

# Copy only ca-certificates without any dependencies
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# Smaller package install size.
COPY excludes /etc/dpkg/dpkg.cfg.d/excludes

# Convenience script for building on this base image.
COPY clean-install /usr/local/bin/clean-install

# An attempt to fix issues like:
# ```
# Error while loading /usr/sbin/dpkg-split: No such file or directory
# Error while loading /usr/sbin/dpkg-deb: No such file or directory
# ```
# See: https://github.com/docker/buildx/issues/495
RUN ln -s /usr/bin/dpkg-split /usr/sbin/dpkg-split && \
ln -s /usr/bin/dpkg-deb /usr/sbin/dpkg-deb && \
ln -s /bin/tar /usr/sbin/tar && \
ln -s /bin/rm /usr/sbin/rm

# Update system packages.
RUN apt-get update \
&& apt-get dist-upgrade -y

# Remove unnecessary packages.
RUN dpkg --purge --force-remove-essential \
bash \
e2fsprogs \
libss2 \
libcom-err2 \
libext2fs2 \
logsave \
ncurses-base \
ncurses-bin \
tzdata \
&& apt-get autoremove --purge -y

# No-op stubs replace some unnecessary binaries that may be depended on in the install process (in
# particular we don't run an init process).
WORKDIR /usr/local/bin
RUN touch noop && \
chmod 555 noop && \
ln -s noop runlevel && \
ln -s noop invoke-rc.d && \
ln -s noop update-rc.d
WORKDIR /

# Cleanup cached and unnecessary files.
RUN apt-get autoremove -y && \
apt-get clean -y && \
tar -czf /usr/share/copyrights.tar.gz /usr/share/common-licenses /usr/share/doc/*/copyright && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/usr/share/common-licenses* \
/usr/share/bash-completion \
~/.bashrc \
~/.profile \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
mkdir -p /usr/share/man/man1 /usr/share/man/man2 \
/usr/share/man/man3 /usr/share/man/man4 \
/usr/share/man/man5 /usr/share/man/man6 \
/usr/share/man/man7 /usr/share/man/man8
36 changes: 36 additions & 0 deletions images/build/debian-base/trixie/clean-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A script encapsulating a common Dockerimage pattern for installing packages
# and then cleaning up the unnecessary install artifacts.
# e.g. clean-install iptables ebtables conntrack

set -o errexit

if [ $# = 0 ]; then
echo >&2 "No packages specified"
exit 1
fi

apt-get update
apt-get install -y --no-install-recommends $@
apt-get clean -y
rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
/var/log/* \
/tmp/* \
/var/tmp/*
10 changes: 10 additions & 0 deletions images/build/debian-base/trixie/excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
path-exclude /usr/share/doc/*
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/groff/*
path-exclude /usr/share/i18n/locales/*
path-include /usr/share/i18n/locales/en_US*
path-exclude /usr/share/info/*
path-exclude /usr/share/locale/*
path-include /usr/share/locale/en_US*
path-include /usr/share/locale/locale.alias
path-exclude /usr/share/man/*
3 changes: 3 additions & 0 deletions images/build/debian-base/variants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ variants:
bookworm:
CONFIG: 'bookworm'
IMAGE_VERSION: 'bookworm-v1.0.7'
trixie:
CONFIG: 'trixie'
IMAGE_VERSION: 'trixie-v1.0.0'