-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.distroless
43 lines (40 loc) · 1.9 KB
/
Dockerfile.distroless
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Extract dependencies
#FROM busybox:glibc as busybox
#RUN for j in busybox --list-full; do \
# mkdir -p $j && ln -s /bin/busybox $j; done
FROM debian:buster-slim AS deb_extractor
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
DEBIAN_CODENAME=buster \
DEBIAN_MIRROR=http://mirrors.163.com/debian
COPY dpkg.cfg.excludes /etc/dpkg/dpkg.cfg.d/01_excludes
#COPY ./getdeps.sh /tmp/getdeps.sh
#RUN ./getdeps.sh adduser libgcc1 libc6 libstdc++6 tini busybox iptables psmisc dante-server
RUN echo "deb $DEBIAN_MIRROR $DEBIAN_CODENAME main contrib" > /etc/apt/sources.list \
&& apt-get update \
&& apt install busybox
# && cd /bin && rm sh && ln -s busybox sh
# && apt install apt-rdepends \
# && apt-get download $(apt-rdepends -s=DEPENDS bash busybox tini iptables psmisc dante-server)\
RUN cd /tmp \
&& apt-get install -d --reinstall -y \
libc6 libgcc1 gcc-8-base libstdc++6 libtinfo6 \
coreutils base-files debianutils \
bash tini psmisc busybox iptables \
dante-server libpam0g libpam-pwdfile libaudit1 libaudit-common libcap-ng0 \
&& mkdir -p ./dpkg/var/lib/dpkg/status.d \
&& for pkg in /var/cache/apt/archives/*.deb; do \
package_name=$(dpkg-deb -I ${pkg} | awk '/^ Package: .*$/ {print $2}'); \
echo "Process: ${package_name}"; \
dpkg --ctrl-tarfile $pkg | tar -Oxf - ./control > ./dpkg/var/lib/dpkg/status.d/${package_name}; \
dpkg --extract $pkg ./dpkg || exit 10; \
done \
&& rm -r ./dpkg/usr/share/doc/* ./dpkg/usr/share/man/* ./dpkg/usr/share/locale/* \
&& cd /tmp/dpkg/usr/bin && rm tini-static \
&& cd /tmp/dpkg/usr/sbin && ln -s danted sockd \
&& busybox --install -s /tmp/dpkg/bin
# && cp /bin/sh /tmp/dpkg/bin/sh
# && find /tmp/dpkg/ -type d -empty -delete \
#FROM gcr.io/distroless/base
FROM gcr.io/distroless/cc-debian10:latest AS runtime
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
COPY --from=deb_extractor /tmp/dpkg /