Skip to content

Commit ffe5e39

Browse files
chore: Optimize file cleanup in Dockerfile
Replaced multiple rm commands with a single find command to delete temporary and unnecessary files in the Dockerfile. run-ci
1 parent 42e4e7a commit ffe5e39

1 file changed

Lines changed: 7 additions & 29 deletions

File tree

code-server/Dockerfile

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ RUN set -ex && \
8989
&& \
9090
# Remove temporary and unnecessary files
9191
apt-get clean && \
92-
rm -rf /var/lib/apt/lists/* \
93-
/config/* \
94-
/tmp/* \
95-
/var/tmp/*
92+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
9693

9794
# =============================================================================
9895
# Builder stage for proot - Used to compile the proot binary from source
@@ -348,7 +345,6 @@ RUN set -ex && \
348345
\
349346
# Clear npm cache
350347
npm cache clean --force && \
351-
rm -rf /config/.npm /config/.cache && \
352348
\
353349
# Install Antigravity CLI globally
354350
curl -fsSL https://antigravity.google/cli/install.sh | bash -s -- --dir /usr/local/bin && \
@@ -358,10 +354,7 @@ RUN set -ex && \
358354
\
359355
# Remove temporary and unnecessary files
360356
apt-get clean && \
361-
rm -rf /var/lib/apt/lists/* \
362-
/config/* \
363-
/tmp/* \
364-
/var/tmp/*
357+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
365358

366359
RUN set -ex && \
367360
\
@@ -372,10 +365,7 @@ RUN set -ex && \
372365
\
373366
# Remove temporary and unnecessary files
374367
apt-get clean && \
375-
rm -rf /var/lib/apt/lists/* \
376-
/config/* \
377-
/tmp/* \
378-
/var/tmp/*
368+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
379369

380370
RUN set -ex && \
381371
\
@@ -388,10 +378,7 @@ RUN set -ex && \
388378
\
389379
# Remove temporary and unnecessary files
390380
apt-get clean && \
391-
rm -rf /var/lib/apt/lists/* \
392-
/config/* \
393-
/tmp/* \
394-
/var/tmp/*
381+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
395382

396383
RUN set -ex && \
397384
\
@@ -400,10 +387,7 @@ RUN set -ex && \
400387
\
401388
# Remove temporary and unnecessary files
402389
apt-get clean && \
403-
rm -rf /var/lib/apt/lists/* \
404-
/config/* \
405-
/tmp/* \
406-
/var/tmp/*
390+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
407391

408392
RUN set -ex && \
409393
\
@@ -424,10 +408,7 @@ RUN set -ex && \
424408
\
425409
# Remove temporary and unnecessary files
426410
apt-get clean && \
427-
rm -rf /var/lib/apt/lists/* \
428-
/config/* \
429-
/tmp/* \
430-
/var/tmp/*
411+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
431412

432413
ARG UV_NO_CACHE=1
433414

@@ -508,10 +489,7 @@ RUN set -ex && \
508489
\
509490
# Remove temporary and unnecessary files
510491
apt-get clean && \
511-
rm -rf /var/lib/apt/lists/* \
512-
/config/* \
513-
/tmp/* \
514-
/var/tmp/*
492+
find /config /tmp /var/tmp /var/lib/apt/lists -mindepth 1 -delete
515493

516494
# Expose the necessary port
517495
EXPOSE 8443

0 commit comments

Comments
 (0)