Skip to content

Commit 67935de

Browse files
committed
add debian trixie support for debian-base
1 parent 9e3980c commit 67935de

5 files changed

Lines changed: 168 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2021 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM scratch
16+
17+
ADD rootfs.tar /
18+
19+
CMD ["/bin/sh"]
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright 2021 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG BASEIMAGE
16+
17+
FROM $BASEIMAGE AS certs
18+
19+
ENV DEBIAN_FRONTEND=noninteractive
20+
21+
# Install ca-certificates and dependencies
22+
RUN apt-get update \
23+
&& apt-get install -y ca-certificates
24+
25+
FROM $BASEIMAGE
26+
27+
ENV DEBIAN_FRONTEND=noninteractive
28+
29+
# Copy only ca-certificates without any dependencies
30+
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
31+
32+
# Smaller package install size.
33+
COPY excludes /etc/dpkg/dpkg.cfg.d/excludes
34+
35+
# Convenience script for building on this base image.
36+
COPY clean-install /usr/local/bin/clean-install
37+
38+
# An attempt to fix issues like:
39+
# ```
40+
# Error while loading /usr/sbin/dpkg-split: No such file or directory
41+
# Error while loading /usr/sbin/dpkg-deb: No such file or directory
42+
# ```
43+
# See: https://github.com/docker/buildx/issues/495
44+
RUN ln -s /usr/bin/dpkg-split /usr/sbin/dpkg-split && \
45+
ln -s /usr/bin/dpkg-deb /usr/sbin/dpkg-deb && \
46+
ln -s /bin/tar /usr/sbin/tar && \
47+
ln -s /bin/rm /usr/sbin/rm
48+
49+
# Update system packages.
50+
RUN apt-get update \
51+
&& apt-get dist-upgrade -y
52+
53+
# Remove unnecessary packages.
54+
RUN dpkg --purge --force-remove-essential \
55+
bash \
56+
e2fsprogs \
57+
libss2 \
58+
libcom-err2 \
59+
libext2fs2 \
60+
logsave \
61+
ncurses-base \
62+
ncurses-bin \
63+
tzdata \
64+
&& apt-get autoremove --purge -y
65+
66+
# No-op stubs replace some unnecessary binaries that may be depended on in the install process (in
67+
# particular we don't run an init process).
68+
WORKDIR /usr/local/bin
69+
RUN touch noop && \
70+
chmod 555 noop && \
71+
ln -s noop runlevel && \
72+
ln -s noop invoke-rc.d && \
73+
ln -s noop update-rc.d
74+
WORKDIR /
75+
76+
# Cleanup cached and unnecessary files.
77+
RUN apt-get autoremove -y && \
78+
apt-get clean -y && \
79+
tar -czf /usr/share/copyrights.tar.gz /usr/share/common-licenses /usr/share/doc/*/copyright && \
80+
rm -rf \
81+
/usr/share/doc \
82+
/usr/share/man \
83+
/usr/share/info \
84+
/usr/share/locale \
85+
/var/lib/apt/lists/* \
86+
/var/log/* \
87+
/var/cache/debconf/* \
88+
/usr/share/common-licenses* \
89+
/usr/share/bash-completion \
90+
~/.bashrc \
91+
~/.profile \
92+
/etc/systemd \
93+
/lib/lsb \
94+
/lib/udev \
95+
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
96+
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
97+
mkdir -p /usr/share/man/man1 /usr/share/man/man2 \
98+
/usr/share/man/man3 /usr/share/man/man4 \
99+
/usr/share/man/man5 /usr/share/man/man6 \
100+
/usr/share/man/man7 /usr/share/man/man8
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
# Copyright 2021 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# A script encapsulating a common Dockerimage pattern for installing packages
18+
# and then cleaning up the unnecessary install artifacts.
19+
# e.g. clean-install iptables ebtables conntrack
20+
21+
set -o errexit
22+
23+
if [ $# = 0 ]; then
24+
echo >&2 "No packages specified"
25+
exit 1
26+
fi
27+
28+
apt-get update
29+
apt-get install -y --no-install-recommends $@
30+
apt-get clean -y
31+
rm -rf \
32+
/var/cache/debconf/* \
33+
/var/lib/apt/lists/* \
34+
/var/log/* \
35+
/tmp/* \
36+
/var/tmp/*
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
path-exclude /usr/share/doc/*
2+
path-include /usr/share/doc/*/copyright
3+
path-exclude /usr/share/groff/*
4+
path-exclude /usr/share/i18n/locales/*
5+
path-include /usr/share/i18n/locales/en_US*
6+
path-exclude /usr/share/info/*
7+
path-exclude /usr/share/locale/*
8+
path-include /usr/share/locale/en_US*
9+
path-include /usr/share/locale/locale.alias
10+
path-exclude /usr/share/man/*

images/build/debian-base/variants.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ variants:
22
bookworm:
33
CONFIG: 'bookworm'
44
IMAGE_VERSION: 'bookworm-v1.0.8'
5+
trixie:
6+
CONFIG: 'trixie'
7+
IMAGE_VERSION: 'trixie-v1.0.0'

0 commit comments

Comments
 (0)