Skip to content

Commit e350468

Browse files
committed
[manylinux2010] Reduce image size
Final image size is now built from scratch because almost everything gets replaced in the base centos:6 image which means it's useless to pull this base image as it will not help with caching but just increase storage/bandwidth requirements when the host does not use centos:6 base image for other images => 384 MB (including centos:6, 194MB) -> 200MB
1 parent d92da2e commit e350468

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

docker/glibc/Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM centos:6
2-
LABEL maintainer="The Manylinux project"
1+
FROM centos:6 AS manylinux2010_centos-6-no-vsyscall-build
32

43
# do not install debuginfo and what x86_64 already provides
54
COPY --from=quay.io/pypa/manylinux2010_centos-6-with-vsyscall32:latest \
@@ -32,10 +31,22 @@ RUN sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf &&
3231
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo && \
3332
sed -i 's;^#baseurl=http://mirror;baseurl=https://vault;g' /etc/yum.repos.d/*.repo
3433

35-
RUN yum install -y glibc.i686 glibc-devel.i686 glibc-static.i686 glibc.x86_64 glibc-devel.x86_64 glibc-static.x86_64 && \
36-
yum -y install /rpms/* && rm -rf /rpms && yum -y clean all && rm -rf /var/cache/yum/* && \
34+
RUN yum update -y && \
35+
yum install -y glibc.i686 glibc-devel.i686 glibc-static.i686 glibc.x86_64 glibc-devel.x86_64 glibc-static.x86_64 && \
36+
yum -y install /rpms/* && rm -rf /rpms && rpm --rebuilddb && yum -y clean all && rm -rf /var/cache/yum/* && \
3737
# if we updated glibc, we need to strip locales again...
3838
localedef --list-archive | grep -v -i ^en_US.utf8 | xargs localedef --delete-from-archive && \
3939
mv -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl && \
4040
build-locale-archive && \
41-
find /usr/share/locale -mindepth 1 -maxdepth 1 -not \( -name 'en*' -or -name 'locale.alias' \) | xargs rm -rf
41+
find /usr/share/locale -mindepth 1 -maxdepth 1 -not \( -name 'en*' -or -name 'locale.alias' \) | xargs rm -rf && \
42+
rm -rf /root/* /tmp/* /var/log/*
43+
44+
RUN ln -sf cracklib-small.pwi /usr/share/cracklib/pw_dict.pwi && \
45+
ln -sf cracklib-small.pwd /usr/share/cracklib/pw_dict.pwd && \
46+
rm -rf /var/lib/yum/history/* && \
47+
find /usr/lib64/python2.6 \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -delete
48+
49+
FROM scratch
50+
LABEL maintainer="The Manylinux project"
51+
COPY --from=manylinux2010_centos-6-no-vsyscall-build / /
52+
CMD ["/bin/bash"]

docker/glibc/build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ case "${1-}" in
3131
;;
3232
all)
3333
docker_build \
34-
-t quay.io/pypa/manylinux2010_centos-6-no-vsyscall:latest \
34+
--target manylinux2010_centos-6-no-vsyscall-build \
35+
-t quay.io/pypa/manylinux2010_centos-6-no-vsyscall-build:latest \
3536
--cache-from quay.io/pypa/manylinux2010_centos-6-with-vsyscall32:latest \
3637
--cache-from quay.io/pypa/manylinux2010_centos-6-with-vsyscall64:latest \
38+
--cache-from quay.io/pypa/manylinux2010_centos-6-no-vsyscall-build:latest
39+
docker_build \
40+
-t quay.io/pypa/manylinux2010_centos-6-no-vsyscall:latest \
41+
--cache-from quay.io/pypa/manylinux2010_centos-6-no-vsyscall-build:latest \
3742
--cache-from quay.io/pypa/manylinux2010_centos-6-no-vsyscall:latest
3843
;;
3944
*)

0 commit comments

Comments
 (0)