Allow tasks in distroless images

This commit is contained in:
Mikhail Gordeev 2023-02-15 20:26:28 +03:00
parent dad90431e3
commit d7f23121aa
2 changed files with 9 additions and 1 deletions

View File

@ -365,6 +365,14 @@ class DockerBuilder:
run(["buildah", "from", "--arch", arch, "--name", new, distroless.from_])
if packages := distroless.builder_install_packages:
tasks = self.tasks.get(self.branch, image)
if tasks:
if arch == "386":
apt_repo_add = ["linux32", "apt-repo", "add"]
else:
apt_repo_add = ["apt-repo", "add"]
for task in tasks:
run(["buildah", "run", builder] + apt_repo_add + [task])
run(["buildah", "run", builder, "apt-get", "update"])
run(
["buildah", "run", builder, "apt-get", "reinstall", "-y"] + packages

View File

@ -4,7 +4,7 @@ MAINTAINER alt-cloud
RUN echo %_excludedocs 1 >> /etc/rpm/macros
RUN rpm -qalds | awk '/^normal/{print $2}' | xargs rm -rf
{{ install_pakages("python3", "glibc-utils") }}
{{ install_pakages("python3", "glibc-utils", "apt-repo") }}
WORKDIR /usr/src/distroless
RUN mkdir file-lists
RUN useradd -m nonroot