Skip to content

Commit 5df4b65

Browse files
committed
update: add deep-clean.
1 parent b614f34 commit 5df4b65

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

Dockerfile

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ RUN bun install --frozen-lockfile --production && \
1111
rm -rf ~/.bun/install/cache /tmp/*
1212

1313
# well-known OSS docker image
14-
FROM chromedp/headless-shell:143.0.7445.3 AS final
14+
FROM chromedp/headless-shell:143.0.7445.3 AS chromedp
1515

16-
# install fonts only
16+
# install required packages
1717
RUN apt-get update && \
1818
apt-get install -y --no-install-recommends \
1919
tini \
@@ -24,10 +24,48 @@ RUN apt-get update && \
2424
apt-get clean && \
2525
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/archives/*
2626

27-
# copy bun from debian base above!
27+
# cleanup unnecessary files
28+
RUN rm -rf \
29+
/usr/lib/aarch64-linux-gnu/gconv/* \
30+
/usr/lib/aarch64-linux-gnu/security/* \
31+
/usr/share/zoneinfo/* \
32+
/usr/lib/apt/* \
33+
/usr/lib/aarch64-linux-gnu/perl-base \
34+
/usr/share/perl5 \
35+
/usr/share/doc \
36+
/usr/share/bash-completion
37+
38+
# cleanup binaries
39+
RUN rm -f \
40+
/usr/bin/apt* \
41+
/usr/bin/dpkg* \
42+
/usr/bin/bash \
43+
/usr/bin/perl* \
44+
/usr/bin/openssl \
45+
/usr/bin/sqv \
46+
/usr/bin/tini-static
47+
48+
# cleanup libraries
49+
RUN rm -f \
50+
/usr/lib/aarch64-linux-gnu/libapt-pkg.so.* \
51+
/usr/lib/aarch64-linux-gnu/libapt-private.so.* \
52+
/usr/lib/aarch64-linux-gnu/libcrypto.so.* \
53+
/usr/lib/aarch64-linux-gnu/libssl.so.* \
54+
/usr/lib/aarch64-linux-gnu/libdb-5.3.so
55+
56+
# cleanup swiftshader
57+
# NOTE: comment out if causes issues
58+
RUN rm -f \
59+
/headless-shell/libvk_swiftshader.so \
60+
/headless-shell/vk_swiftshader_icd.json \
61+
/headless-shell/run.sh
62+
63+
# squash layers
64+
FROM scratch AS final
65+
COPY --from=chromedp / /
2866
COPY --from=base /usr/local/bin/bun /usr/local/bin/bun
2967

30-
# Add chrome user
68+
# add chrome user
3169
RUN groupadd -r chrome && useradd -r -g chrome chrome
3270

3371
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \

0 commit comments

Comments
 (0)