Skip to content

Commit

Permalink
chore: Remove google-cloud-sdk archive from python image
Browse files Browse the repository at this point in the history
Currently the tar archive for the google-cloud-sdk is not deleted after
it is unpacked. This bloats the resulting docker image with ~189 MB of
unused data.

```
(base) root@8eda5cb5bf03:/# ls -lh
total 272M
-rw-r--r--   1 root root  83M Nov 22  2023 Mambaforge.sh
lrwxrwxrwx   1 root root    7 Oct  3  2023 bin -> usr/bin
drwxr-xr-x   2 root root 4.0K Apr 15  2020 boot
drwxr-xr-x   5 root root  360 Jun 27 16:42 dev
drwxr-xr-x   1 root root 4.0K Jun 27 16:42 etc
drwxr-xr-x  15 root root 4.0K Jun 27 16:49 google-auth-library-python
drwxr-xr-x   1 root root 4.0K Nov 22  2023 google-cloud-sdk
-rw-r--r--   1 root root 189M Feb 28  2023 google-cloud-sdk-420.0.0-linux-x86_64.tar.gz

. . .
```

Removing the tar.gz file after unpacking it will slim the resulting
image by ~189 MB.
  • Loading branch information
clundin25 committed Jun 27, 2024
1 parent c734af0 commit 7d9035e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/googleapis/python-multi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ ENV CLOUD_SDK_VERSION 420.0.0
# Use system python for cloud sdk.
ENV CLOUDSDK_PYTHON python3.9
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN tar xzf google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN tar xzf google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz && rm google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz
RUN /google-cloud-sdk/install.sh
ENV PATH /google-cloud-sdk/bin:$PATH

Expand Down

0 comments on commit 7d9035e

Please sign in to comment.