feat(docker): introduce slim.sh for safe image cleanup and run it during build
- add verbose distro-aware cleanup script (apk/apt/pacman/dnf/yum) - remove package manager caches, logs, tmp and user caches - keep runtime-critical files untouched - execute cleanup during image build to reduce final size https://chatgpt.com/share/696f4ab6-fae8-800f-9a46-e73eb8317791
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -24,6 +24,12 @@ COPY scripts/installation/ scripts/installation/
|
||||
# Install distro-specific build dependencies (including make)
|
||||
RUN bash scripts/installation/dependencies.sh
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Image cleanup (reduce final size)
|
||||
# ------------------------------------------------------------
|
||||
COPY scripts/docker/slim.sh /usr/local/bin/slim.sh
|
||||
RUN chmod +x /usr/local/bin/slim.sh && /usr/local/bin/slim.sh
|
||||
|
||||
# Virgin default
|
||||
CMD ["bash"]
|
||||
|
||||
@@ -52,4 +58,10 @@ COPY scripts/docker/entry.sh /usr/local/bin/docker-entry.sh
|
||||
|
||||
WORKDIR /opt/src/pkgmgr
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entry.sh"]
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Image cleanup (reduce final size)
|
||||
# ------------------------------------------------------------
|
||||
RUN /usr/local/bin/slim.sh
|
||||
|
||||
CMD ["pkgmgr", "--help"]
|
||||
|
||||
Reference in New Issue
Block a user