Skip to content

Commit

Permalink
Remove unused* data to reduce image size.
Browse files Browse the repository at this point in the history
`*` Hopefully. Removed paths include
- /tmp
- /boot
- /usr/lib/firmware
- /usr/lib/jvm/java-8-openjdk-amd64
  - may need to add this one back in later
- /usr/share/doc
- /usr/share/man
- /usr/share/locale/{locale}
  - for {locale} other than `en`
  • Loading branch information
dakotablair committed Jul 17, 2024
1 parent 242789a commit 2cb738b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ FROM kbase/kb-sdk:1.2.1

COPY update.sh /update.sh
RUN /update.sh
RUN rm -rf /tmp /boot && mkdir /tmp && mkdir /boot
RUN chmod 777 /.docker /boot /tmp
27 changes: 26 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,30 @@ for pkg in docker.io docker-doc docker-compose docker-compose-v2 \
apt install -y curl
apt autoremove -y
curl -fsSL https://get.docker.com | sh
apt remove -y $(dpkg-query --show 'linux-modules-*' | cut -f1 | grep -v "$(uname -r)")
rm -rf \
/tmp \
/boot \
/usr/lib/firmware \
/usr/lib/jvm/java-8-openjdk-amd64 \
/usr/share/doc \
/usr/share/man
find /usr/share/locale \
-mindepth 1 -maxdepth 1 \
-not -name en \
-execdir rm -rf {} +
mkdir /.docker
chmod 777 /.docker
mkdir /tmp
mkdir /boot
mkdir -p /usr/lib/firmware
mkdir -p /usr/lib/jvm/java-8-openjdk-amd64
mkdir -p /usr/share/doc
mkdir -p /usr/share/man
chmod 777 \
/.docker \
/boot \
/tmp \
/usr/lib/firmware \
/usr/lib/jvm/java-8-openjdk-amd64 \
/usr/share/doc \
/usr/share/man

0 comments on commit 2cb738b

Please sign in to comment.