-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新的debian镜像相对于之前太大了 #25
Comments
上一个版本和最新版本的列表是不是粘贴反了? |
是的,修改过来了 |
下面的包是可以移除的,移除后大小和官方大小相差不大。移除的包是参考 amd64, arm64 架构的 debian:buster-slim 镜像,通过 最终制作的
移除前后大小 301M /usr
4.0K /home
4.0K /mnt
752K /etc
0 /dev
4.0K /boot
0 /sys
12K /run
4.0K /media
0 /proc
4.0K /opt
12K /root
4.0K /lib64
7.8M /var
4.0K /srv
4.0K /tmp
309M / apt-get autoremove libapparmor1 libargon2-1 libbsd0 libc-dev-bin libc6-dev \
libcap2 libcryptsetup12 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common \
libdrm-etnaviv1 libdrm-gsgpu1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 \
libegl-mesa0 libegl1 libelf1 libexpat1 libffi-dev libgbm1 libgl1 libgl1-mesa-dri \
libglapi-mesa libgles1 libgles2 libglvnd-core-dev libglvnd-dev libglvnd0 libglx-mesa0 \
libglx0 libidn11 libip4tc2 libjson-c3 libkmod2 libllvm8 libncurses-dev libncurses6 \
libopengl0 libsensors-config libsensors5 libssl1.1 libtinfo-dev libwayland-client0 \
libwayland-server0 libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 \
libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1 libxdamage1 libxdmcp6 \
libxext6 libxfixes3 libxshmfence1 libxxf86vm1 linux-libc-dev loonggl-dev loonggpu-compiler \
loonggpu-compiler-dev loongnix-gpu-driver-service systemd util-linux-extra
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
dmsetup libapparmor1 libargon2-1 libbsd0 libc-dev-bin libc6-dev libcap2 libcryptsetup12 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common libdrm-etnaviv1 libdrm-gsgpu1 libdrm-nouveau2
libdrm-radeon1 libdrm2 libedit2 libegl-mesa0 libegl1 libelf1 libexpat1 libffi-dev libgbm1 libgl1 libgl1-mesa-dri libglapi-mesa libgles1 libgles2 libglvnd-core-dev libglvnd-dev
libglvnd0 libglx-mesa0 libglx0 libidn11 libip4tc2 libjson-c3 libkmod2 libllvm8 libncurses-dev libncurses6 libopengl0 libsensors-config libsensors5 libssl1.1 libtinfo-dev
libwayland-client0 libwayland-server0 libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1
libxdamage1 libxdmcp6 libxext6 libxfixes3 libxshmfence1 libxxf86vm1 linux-libc-dev loonggl loonggl-dev loonggpu-compiler loonggpu-compiler-dev loongnix-gpu-driver-service systemd
sysvinit-utils util-linux util-linux-extra
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
sysvinit-utils util-linux (due to sysvinit-utils) util-linux-extra (due to util-linux)
0 upgraded, 0 newly installed, 74 to remove and 0 not upgraded.
After this operation, 381 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] Yes, do as I say!
(Reading database ... 11030 files and directories currently installed.)
Removing loonggl:loongarch64 (0.1.0-1+deb10u1.lnd.3) ...
Removing loongnix-gpu-driver-service (0.0.1-1.lnd.3) ...
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Removing systemd (241-7.lnd.11) ...
Removing libcryptsetup12:loongarch64 (2:2.1.0-5+deb10u2.1) ...
Removing libapparmor1:loongarch64 (2.13.2-10.1) ...
Removing libargon2-1:loongarch64 (0~20171227-0.2.lnd.2) ...
Removing libglvnd-dev:loongarch64 (1.1.0-1.lnd.4) ...
Removing libegl1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libegl-mesa0:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libgl1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglx0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglx-mesa0:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libxcb-dri3-0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-xfixes0:loongarch64 (1.13.1-2.1) ...
Removing libgl1-mesa-dri:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libllvm8:loongarch64 (1:8.0.1-3~bpo10+1.lnd.37) ...
Removing libedit2:loongarch64 (3.1-20181209-1.1) ...
Removing loonggpu-compiler-dev (0.1.0-lnd.3) ...
Removing libtinfo-dev:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libncurses-dev:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libc6-dev:loongarch64 (2.28-10.lnd.35) ...
Removing libc-dev-bin (2.28-10.lnd.35) ...
Removing libcap2:loongarch64 (1:2.25-2.1) ...
Removing libdrm-amdgpu1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libgbm1:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libdrm-etnaviv1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-gsgpu1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-nouveau2:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-radeon1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libelf1:loongarch64 (0.176-1.2) ...
Removing libexpat1:loongarch64 (2.2.6-2+deb10u4.lnd.2) ...
Removing libffi-dev:loongarch64 (3.3-5.lnd.4) ...
Removing libglapi-mesa:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libgles1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libgles2:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglvnd-core-dev:loongarch64 (1.1.0-1.lnd.4) ...
Removing libopengl0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglvnd0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libidn11:loongarch64 (1.33-2.3) ...
Removing libip4tc2:loongarch64 (1.8.7-1.1) ...
Removing libjson-c3:loongarch64 (0.12.1+ds-2.lnd.2) ...
Removing libkmod2:loongarch64 (26-1.1) ...
Removing libncurses6:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libsensors5:loongarch64 (1:3.5.0-3.1) ...
Removing libsensors-config (1:3.5.0-3.1) ...
Removing libssl1.1:loongarch64 (1.1.1d-0+lnd.11) ...
Removing libwayland-client0:loongarch64 (1.16.0-1.1) ...
Removing libwayland-server0:loongarch64 (1.16.0-1.1) ...
Removing libxxf86vm1:loongarch64 (1:1.1.4-1.1) ...
Removing libxext6:loongarch64 (2:1.3.3-1.1) ...
Removing libxdamage1:loongarch64 (1:1.1.4-3.1) ...
Removing libxfixes3:loongarch64 (1:5.0.3-1.1) ...
Removing libx11-6:loongarch64 (4:1.6.7-1.lnd.1) ...
Removing libx11-data (4:1.6.7-1.lnd.1) ...
Removing libx11-xcb1:loongarch64 (4:1.6.7-1.lnd.1) ...
Removing libxcb-dri2-0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-glx0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-present0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-sync1:loongarch64 (1.13.1-2.1) ...
Removing libxshmfence1:loongarch64 (1.3-1.1) ...
Removing linux-libc-dev (1:4.19.190.8.11-lnd.2) ...
Removing loonggl-dev:loongarch64 (0.1.0-1+deb10u1.lnd.3) ...
Removing loonggpu-compiler (0.1.0-lnd.3) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: this is an essential package; it should not be removed
Removing sysvinit-utils (2.93-8.1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: this is an essential package; it should not be removed
Removing util-linux (2.38.1-5.lnd.1) ...
Removing util-linux-extra (2.38.1-5.lnd.1) ...
Removing libxcb1:loongarch64 (1.13.1-2.1) ...
Removing libxdmcp6:loongarch64 (1:1.1.2-3.1) ...
Removing libbsd0:loongarch64 (0.9.1-2.lnd.3) ...
Removing libdrm2:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-common (2.4.97-1.lnd.6) ...
Removing libxau6:loongarch64 (1:1.0.8-1.1) ...
Removing dmsetup (2:1.02.155-3.lnd.2) ...
Removing libdevmapper1.02.1:loongarch64 (2:1.02.155-3.lnd.2) ...
Processing triggers for libc-bin (2.28-10.lnd.35) ... dpkg -l | grep "^rc" | awk '{print $2}' | xargs apt-get purge -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libgl1-mesa-dri* libsensors-config* libssl1.1* loongnix-gpu-driver-service* systemd* util-linux* util-linux-extra*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 6209 files and directories currently installed.)
Purging configuration files for libssl1.1:loongarch64 (1.1.1d-0+lnd.11) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/loongarch64-linux-gnu/perl/5.28.1 /usr/loca/share/perl/5.28.1 /usr/lib/loongarch64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/loongarch64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/loongarch6-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Purging configuration files for libgl1-mesa-dri:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Purging configuration files for libsensors-config (1:3.5.0-3.1) ...
Purging configuration files for systemd (241-7.lnd.11) ...
dpkg: warning: while removing systemd, directory '/usr/lib/systemd' not empty so not removed
Purging configuration files for util-linux (2.38.1-5.lnd.1) ...
Purging configuration files for loongnix-gpu-driver-service (0.0.1-1.lnd.3) ...
/var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: 8: /var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: systemctl: not found
/var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: 20: /var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: systemctl: not found
Purging configuration files for util-linux-extra (2.38.1-5.lnd.1) ... 69M /usr
4.0K /home
4.0K /mnt
596K /etc
0 /dev
4.0K /boot
0 /sys
12K /run
4.0K /media
0 /proc
4.0K /opt
12K /root
4.0K /lib64
5.4M /var
4.0K /srv
24K /tmp
75M / |
你提个pr看看 |
自动脚本构建的我看下 https://github.com/debuerreotype/debuerreotype 的实现, |
主要是官方的镜像的rootfs.tar.gz不知道怎么构建出来的 |
我发的这个仓库就是构建 debian 的 rootfs.tar.gz,脚本都有说明,我已经在研究了。 docker run --rm --privileged -it cr.loongnix.cn/library/debian:buster bash apt-get update
apt-get install -y debootstrap wget ca-certificates xz-utils git gnupg dirmngr git clone -b 0.15 --depth=1 https://github.com/debuerreotype/debuerreotype /opt/debuerreotype
cd /opt/debuerreotype
cp examples/ubuntu.sh examples/loongnix.sh root@05001a117a1d:/opt/debuerreotype# diff examples/ubuntu.sh examples/loongnix.sh
5c5
< # && apt-get install -y ubuntu-keyring \
---
> # && apt-get install -y debian-keyring \
16,17c16,17
< 'output xenial
< --arch arm64 output bionic'
---
> 'output DaoXiangHu-stable
> --arch loongarch64 output DaoXiangHu-stable'
35a36
> mkdir -p $outputDir
46c47
< archDir="$exportDir/ubuntu/$dpkgArch"
---
> archDir="$exportDir/loongnix/$dpkgArch"
50,52c51,53
< amd64 | i386)
< mirror='http://archive.ubuntu.com/ubuntu'
< secmirror='http://security.ubuntu.com/ubuntu'
---
> loongarch64)
> mirror='http://pkg.loongnix.cn/loongnix'
> secmirror="$mirror"
56,57c57,58
< mirror='http://ports.ubuntu.com/ubuntu-ports'
< secmirror="$mirror" # no separate security mirror for ports
---
> echo "Unsupported architecture: ${dpkgArch}"
> exit 1
63a65
> --exclude 'loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra'
66c68
< keyring='/usr/share/keyrings/ubuntu-archive-keyring.gpg'
---
> keyring='/usr/share/keyrings/debian-archive-keyring.gpg'
105,108c107
< deb $mirror $suite main restricted universe multiverse
< deb $mirror $suite-updates main restricted universe multiverse
< deb $mirror $suite-backports main restricted universe multiverse
< deb $secmirror $suite-security main restricted universe multiverse
---
> deb $mirror $suite main root@05001a117a1d:/opt/debuerreotype# git diff scripts/debuerreotype-init
diff --git a/scripts/debuerreotype-init b/scripts/debuerreotype-init
index 9aa86ca..52714bd 100755
--- a/scripts/debuerreotype-init
+++ b/scripts/debuerreotype-init
@@ -178,6 +178,20 @@ fi
fi
' -- "$include"
+if [ "$arch" == "loongarch64" ]; then
+ "$thisDir/debuerreotype-chroot" "$targetDir" bash -c '
+ if [ -n "$1" ]; then
+ IFS=","; excludePackages=( $1 ); unset IFS
+ apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
+ fi
+ for user in systemd-timesync systemd-network systemd-resolve; do
+ if id $user >/dev/null; then
+ userdel --force --remove $user
+ fi
+ done
+ ' -- "$exclude"
+fi
+
echo 'debuerreotype' > "$targetDir/etc/hostname"
{
echo '# https://1.1.1.1 (privacy-focused, highly-available DNS service)' #
cd /opt/debuerreotype/scripts
for f in debuerreotype-*; do
ln -svL "$PWD/$f" "/usr/local/bin/$f"
done
cd /opt/debuerreotype
ln -svL /usr/share/debootstrap/scripts/DaoXiangHu /opt/debuerreotype/DaoXiangHu-stable # https://github.com/debuerreotype/debuerreotype/blob/0.15/Dockerfile#L57
cd /opt/debuerreotype
./examples/loongnix.sh --arch loongarch64 output DaoXiangHu-stable arch 不能使用 |
loongnix的容器里构建应该也行吧 |
@zhangguanzhang 构建已经完成了,但是多出来的包还是 #25 (comment) 这个回复里面的那些包,大多数是图形显示和显卡驱动相关的依赖包,应该依赖处理不当导致的,容器不需要使用这些包。但是由于
经过分析,都是 debootstrap --exclude="loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra" 🤮 |
action的子托管机器现在进入维护状态了,后续好了你可以提个pr看看 |
@zhangguanzhang 基本构建已经验证完成了,可以 后续的 rootfs.tar.xz 管理可以参考 docker-debian-artifacts 具体架构可以参考:https://github.com/debuerreotype/docker-debian-artifacts/branches/active 最终成果: root@a26bc7a4aaa6:/opt/debuerreotype# ls -al output/loongnix/loongarch64/DaoXiangHu-stable/
total 29016
drwxrwxr-x 3 root root 4096 Aug 7 10:12 .
drwxrwxr-x 3 root root 4096 Aug 7 09:55 ..
-rw-rw-r-- 1 root root 8261 Jul 22 09:17 InRelease
-rw-rw-r-- 1 root root 7553 Aug 7 09:55 Release
-rw-rw-r-- 1 root root 18 Jul 22 09:17 rootfs.apt-dist
-rw-r--r-- 1 root root 5 Jul 22 09:17 rootfs.debian_version
-rw-rw-r-- 1 root root 11 Jul 22 09:17 rootfs.debuerreotype-epoch
-rw-rw-r-- 1 root root 1 Jul 22 09:17 rootfs.debuerreotype-variant
-rw-rw-r-- 1 root root 20 Jul 22 09:17 rootfs.debuerreotype-version
-rw-rw-r-- 1 root root 12 Jul 22 09:17 rootfs.dpkg-arch
-rw-rw-r-- 1 root root 2984 Jul 22 09:17 rootfs.manifest
-rw-r--r-- 1 root root 273 Jul 22 09:17 rootfs.os-release
-rw-r--r-- 1 root root 59 Jul 22 09:17 rootfs.sources-list
-rw-rw-r-- 1 root root 29637832 Jul 22 09:17 rootfs.tar.xz
-rw-rw-r-- 1 root root 65 Jul 22 09:17 rootfs.tar.xz.sha256
drwxrwxr-x 2 root root 4096 Aug 7 10:10 slim
root@a26bc7a4aaa6:/opt/debuerreotype# du -h -d 1 output/loongnix/loongarch64/DaoXiangHu-stable/rootfs.tar.xz
29M output/loongnix/loongarch64/DaoXiangHu-stable/rootfs.tar.xz
root@a26bc7a4aaa6:/opt/debuerreotype# ls -al output/loongnix/loongarch64/DaoXiangHu-stable/slim/
total 14408
drwxrwxr-x 2 root root 4096 Aug 7 10:10 .
drwxrwxr-x 3 root root 4096 Aug 7 10:12 ..
-rw-r--r-- 1 root root 46 Aug 7 05:38 Dockerfile
-rw-rw-r-- 1 root root 18 Jul 22 09:17 rootfs.apt-dist
-rw-r--r-- 1 root root 5 Jul 22 09:17 rootfs.debian_version
-rw-rw-r-- 1 root root 11 Jul 22 09:17 rootfs.debuerreotype-epoch
-rw-rw-r-- 1 root root 5 Jul 22 09:17 rootfs.debuerreotype-variant
-rw-rw-r-- 1 root root 20 Jul 22 09:17 rootfs.debuerreotype-version
-rw-rw-r-- 1 root root 12 Jul 22 09:17 rootfs.dpkg-arch
-rw-rw-r-- 1 root root 2775 Jul 22 09:17 rootfs.manifest
-rw-r--r-- 1 root root 273 Jul 22 09:17 rootfs.os-release
-rw-r--r-- 1 root root 59 Jul 22 09:17 rootfs.sources-list
-rw-rw-r-- 1 root root 14698924 Jul 22 09:17 rootfs.tar.xz
-rw-rw-r-- 1 root root 65 Jul 22 09:17 rootfs.tar.xz.sha256
root@a26bc7a4aaa6:/opt/debuerreotype# du -h -d 1 output/loongnix/loongarch64/DaoXiangHu-stable/slim/rootfs.tar.xz
15M output/loongnix/loongarch64/DaoXiangHu-stable/slim/rootfs.tar.xz linux/loong64 docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
debian buster-slim 50672825a241 14 minutes ago 75MB
debian buster 2502dd931a94 12 minutes ago 120MB linux/amd64 docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
debian buster-slim e1b92a6f8d12 10 days ago 69.3MB
debian buster 1df4474660a1 10 days ago 114MB |
@wojiushixiaobai action机器好了 |
@zhangguanzhang 直接提交到本仓库吗? debuerreotype 是构建 rootfs 的代码仓库,docker-debian-artifacts 是管理 rootfs 的代码仓库 后续可以通过 docker-debian-artifacts 管理 loongnix 的发行版本,比如 20.1, 20.2 20.3 ..... |
|
@zhangguanzhang 反复测试了下,直接修改当前仓库的代码没法达到使用 https://github.com/debuerreotype/debuerreotype 仓库构建的效果,能不能 fork 该项目到 https://github.com/Loongson-Cloud-Community/debuerreotype 然后使用该项目构建。 # git diff
+diff --git a/library/debian/buster-slim/Makefile b/library/debian/buster-slim/Makefile
index 2362add..a595827 100644
--- a/library/debian/buster-slim/Makefile
+++ b/library/debian/buster-slim/Makefile
@@ -7,7 +7,7 @@ TAG?=buster-slim
IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
-ROOTFS=rootfs.tar.gz
+ROOTFS=rootfs.tar.xz
default: image
@@ -17,7 +17,7 @@ image: $(ROOTFS)
-t $(IMAGE) \
.
-push:
+push:
docker push $(IMAGE)
$(ROOTFS):
diff --git a/library/debian/buster-slim/make_rootfs.sh b/library/debian/buster-slim/make_rootfs.sh
index 74a633a..003b18c 100755
--- a/library/debian/buster-slim/make_rootfs.sh
+++ b/library/debian/buster-slim/make_rootfs.sh
@@ -4,24 +4,66 @@ set -e
: ${DISTRO:="loongnix"}
: ${RELEASE:=DaoXiangHu-stable}
: ${MIRROR_ADDRESS:=http://pkg.loongnix.cn/loongnix}
-: ${ROOTFS:="rootfs.tar.gz"}
+: ${ROOTFS:="rootfs.tar.xz"}
: ${APT_CONF_URL:="https://raw.githubusercontent.com/GoogleContainerTools/base-images-docker/master/debian/reproducible/overlay/etc/apt/apt.conf.d/"}
WKDIR=$1
cd ${WKDIR?}
apt update -y
-apt install -y debootstrap curl
+apt install -y debootstrap curl xz-utils
if [ ! -f /usr/share/debootstrap/scripts/$RELEASE ]; then
- ln -s /usr/share/debootstrap/scripts/sid /usr/share/debootstrap/scripts/$RELEASE
+ ln -s /usr/share/debootstrap/scripts/sid /usr/share/debootstrap/scripts/$RELEASE
fi
-TMPDIR=`mktemp -d`
+# https://github.com/GoogleContainerTools/base-images-docker/tree/master/debian/reproducible/overlay/etc/apt/apt.conf.d
+apt_conf=(
+ apt-retry
+ docker-autoremove-suggests
+ docker-clean
+ docker-gzip-indexes
+ docker-no-languages
+)
+
+for apt_file in ${apt_conf[@]}; do
+ if [ ! -f "/etc/apt/apt.conf.d/${apt_file}" ]; then
+ curl -o /etc/apt/apt.conf.d/${apt_file} -sSL ${APT_CONF_URL}/${apt_file}
+ fi
+done
+
+TMPDIR=$(mktemp -d)
cp .slimify-includes $TMPDIR/.slimify-includes
cp .slimify-excludes $TMPDIR/.slimify-excludes
# install packages
-debootstrap --no-check-gpg --variant=minbase --components=main,non-free,contrib --arch=loongarch64 --foreign $RELEASE $TMPDIR $MIRROR_ADDRESS
-chroot $TMPDIR debootstrap/debootstrap --second-stage
+EXCLUDE='loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra'
+debootstrap --variant=minbase --no-merged-usr --no-check-gpg --arch=loongarch64 --exclude=$EXCLUDE $RELEASE $TMPDIR $MIRROR_ADDRESS
+
+chroot $TMPDIR bash -c '
+ apt-get -o Acquire::Check-Valid-Until=false update -qq
+ if apt-mark --help &> /dev/null; then
+ apt-mark auto ".*" > /dev/null
+ fi
+ if [ -n "$1" ]; then
+ IFS=","; excludePackages=( $1 ); unset IFS
+ apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
+ fi
+ for user in systemd-timesync systemd-network systemd-resolve; do
+ if id $user >/dev/null; then
+ userdel --force --remove $user
+ fi
+ done
+' -- "$EXCLUDE"
+
+excludeusers=(
+ systemd-timesync
+ systemd-network
+ systemd-resolve
+)
+
+for excludeuser in ${excludeusers[@]}; do
+ chroot $TMPDIR userdel --force --remove "${excludeuser}" \
+ || echo "${excludeuser} not found"
+done
# slimify
slimIncludes=( $(sed '/^#/d;/^$/d' .slimify-includes | sort -u) )
@@ -48,16 +90,10 @@ for slimExclude in "${slimExcludes[@]}"; do
}
done
-# https://github.com/GoogleContainerTools/base-images-docker/tree/master/debian/reproducible/overlay/etc/apt/apt.conf.d
-apt_conf=(
- apt-retry
- docker-autoremove-suggests
- docker-clean
- docker-gzip-indexes
-)
-
-for apt_file in ${apt_conf[@]};do
- curl -o $TMPDIR/etc/apt/apt.conf.d/${apt_file} -sSL ${APT_CONF_URL}/${apt_file}
+for apt_file in ${apt_conf[@]}; do
+ if [ ! -f "$TMPDIR/etc/apt/apt.conf.d/${apt_file}" ]; then
+ cp -rf $TMPDIR/etc/apt/apt.conf.d/${apt_file} $TMPDIR/etc/apt/apt.conf.d/${apt_file}
+ fi
done
while [ "$(
@@ -69,4 +105,4 @@ while [ "$(
)" -gt 0 ]; do true; done
chroot $TMPDIR rm -rf /tmp/* /var/cache/apt/* /var/lib/apt/lists/*
-tar -zcvf $ROOTFS -C $TMPDIR .
+tar -cJf $ROOTFS -C $TMPDIR . 使用修改后的构建,最终 rootfs.tar.xz 的大小为 38M [root@loong64 buster-slim]# ls -al
总用量 38048
drwxr-xr-x 2 root root 200 10月 4 12:07 .
drwxr-xr-x 5 root root 100 10月 3 17:41 ..
-rw-r--r-- 1 root root 120 10月 3 15:18 Dockerfile
-rw-r--r-- 1 root root 14 10月 3 15:18 .gitignore
-rw-r--r-- 1 root root 546 10月 4 11:38 Makefile
-rwxr-xr-x 1 root root 3464 10月 4 11:41 make_rootfs.sh
-rw-r--r-- 1 root root 38837108 10月 4 12:09 rootfs.tar.xz
-rw-r--r-- 1 root root 706 10月 3 15:18 .slimify-excludes
-rw-r--r-- 1 root root 666 10月 3 15:18 .slimify-includes
-rw-r--r-- 1 root root 1754 10月 3 18:34 .tar-exclude 但是使用 debuerreotype 构建的只有 14M,我已经上传至 https://github.com/wojiushixiaobai/docker-debian-artifacts/tree/dist-loongarch64 docker run --rm --privileged -it cr.loongnix.cn/library/debian:buster bash
apt-get update
apt-get install -y debootstrap wget ca-certificates xz-utils git gnupg dirmngr
git clone --depth=1 https://github.com/wojiushixiaobai/debuerreotype /opt/debuerreotype
cd /opt/debuerreotype/scripts
for f in debuerreotype-*; do
ln -svL "$PWD/$f" "/usr/local/bin/$f"
done
cd /opt/debuerreotype
ln -svL /usr/share/debootstrap/scripts/DaoXiangHu /opt/debuerreotype/DaoXiangHu-stable
mkdir output
./examples/loongnix.sh --arch loongarch64 output DaoXiangHu-stable 构建完成后在 如果能使用 |
你看下文件最初是谁提交的,艾特下它 |
@znley 大佬有空看看 |
@wojiushixiaobai 好的,我这两天看一下这个问题,然后看看怎么处理 |
@wojiushixiaobai 采用 debuerreotype 会影响现有的 CI 运行,目前所有镜像共用一个 CI,并没有单独对 debian 镜像做 CI。我个人认为保持当前状态工作量最小,等新世界 debian 和上游同源之后,支持 debuerreotype 会简单许多。 |
@znley 大佬 666,我看 cr.loongnix.cn 已经更新了镜像,大小非常好。 另外我看提交的代码
还有就是镜像里面 |
当然可以,这是我忽略的部分,你可以按照你的想法提交一下 pr,否则我需要安排一下工作时间来处理这些问题。 |
已更新 #96 |
@zhangguanzhang 可以关问题了老哥。 |
最新的 cr.loongnix.cn/library/debian:buster-slim
上一个版本的 cr.loongnix.cn/library/debian:buster-slim
The text was updated successfully, but these errors were encountered: