[ 
https://issues.apache.org/jira/browse/CASSANDRA-21547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Semb Wever updated CASSANDRA-21547:
-------------------------------------------
    Description: 
cassandra-ubuntu-test is currently 37GB and slows the CI pipeline down a lot.
Background: 
Do the following to reduce the docker image sizes.

1)
Use multi-stages in dockerfiles (to avoid accumulating layer sizes)

 Restructure cassandra-ubuntu-test into three stages:
-   *base*    - all system setup (apt packages, JDKs, python, locales, 
alternatives, java.security edits and the cassandra-tmp build user), written 
once.
-   *builder* - derives from base and does the throw-away heavy work: 
prepopulate the Maven cache and build the five python virtualenvs and the ccm  
repository.
-   *final*   - re-derives from the clean base and only COPY --from=builder the 
generated caches (/home/cassandra and /home/image-cache).

2)
Reduce cassandra-ubuntu-test image size: clean apt caches in-layer
|
| The apt package lists (/var/lib/apt/lists) and downloaded .deb archives
| (/var/cache/apt/archives) were left in the image after each apt-get install.
| Append `apt-get clean && rm -rf /var/lib/apt/lists/*` to the same RUN as each
| install in the base stage so the caches never enter a persisted layer.

> CI: reduce build and test docker image sizes using multi-stage builds
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-21547
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21547
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: CI
>            Reporter: Michael Semb Wever
>            Assignee: Michael Semb Wever
>            Priority: Normal
>             Fix For: 5.0.x, 7.x, 6.0.x
>
>
> cassandra-ubuntu-test is currently 37GB and slows the CI pipeline down a lot.
> Background: 
> Do the following to reduce the docker image sizes.
> 1)
> Use multi-stages in dockerfiles (to avoid accumulating layer sizes)
>  Restructure cassandra-ubuntu-test into three stages:
> -   *base*    - all system setup (apt packages, JDKs, python, locales, 
> alternatives, java.security edits and the cassandra-tmp build user), written 
> once.
> -   *builder* - derives from base and does the throw-away heavy work: 
> prepopulate the Maven cache and build the five python virtualenvs and the ccm 
>  repository.
> -   *final*   - re-derives from the clean base and only COPY --from=builder 
> the generated caches (/home/cassandra and /home/image-cache).
> 2)
> Reduce cassandra-ubuntu-test image size: clean apt caches in-layer
> |
> | The apt package lists (/var/lib/apt/lists) and downloaded .deb archives
> | (/var/cache/apt/archives) were left in the image after each apt-get install.
> | Append `apt-get clean && rm -rf /var/lib/apt/lists/*` to the same RUN as 
> each
> | install in the base stage so the caches never enter a persisted layer.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to