1
0

fix: clean ubuntu modules package

This commit is contained in:
2023-05-18 09:49:48 +00:00
parent a607ce62d1
commit 73b1edd1cb
2 changed files with 53 additions and 13 deletions

View File

@ -25,6 +25,7 @@ import (
"code.dumpstack.io/tools/out-of-tree/config"
"code.dumpstack.io/tools/out-of-tree/container"
"code.dumpstack.io/tools/out-of-tree/distro/debian"
"code.dumpstack.io/tools/out-of-tree/distro/ubuntu"
"code.dumpstack.io/tools/out-of-tree/fs"
)
@ -179,21 +180,12 @@ func GenerateBaseDockerImage(registry string, commands []config.DockerCommand,
switch sk.DistroType {
case config.Ubuntu:
if sk.DistroRelease < "14.04" {
d += "RUN sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/' /etc/apt/sources.list\n"
for _, e := range ubuntu.Envs(sk) {
d += "ENV " + e + "\n"
}
d += "ENV DEBIAN_FRONTEND=noninteractive\n"
d += "RUN apt-get update\n"
d += "RUN apt-get install -y build-essential libelf-dev\n"
d += "RUN apt-get install -y wget git\n"
// Install a single kernel and headers to ensure all dependencies are cached
if sk.DistroRelease >= "14.04" {
d += "RUN export PKGNAME=$(apt-cache search --names-only '^linux-headers-[0-9\\.\\-]*-generic' | awk '{ print $1 }' | head -n 1); " +
"apt-get install -y $PKGNAME $(echo $PKGNAME | sed 's/headers/image/'); " +
"apt-get remove -y $PKGNAME $(echo $PKGNAME | sed 's/headers/image/')\n"
d += "RUN apt-get install -y libseccomp-dev\n"
for _, c := range ubuntu.Runs(sk) {
d += "RUN " + c + "\n"
}
d += "RUN mkdir -p /lib/modules\n"
case config.CentOS:
var repos []string