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

Michael Semb Wever updated CASSANDRA-21547:
-------------------------------------------
    Resolution: Fixed
        Status: Resolved  (was: Triage Needed)

Committed 
https://github.com/apache/cassandra/commit/8582b692e6b9ed85e36fb54577e09c77b9e3d964

> 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: CASSANDRA-21541 and CASSANDRA-21523
> Do the following (to all the dockerfiles) to reduce the docker image sizes.
> 1) Use multi-stages in dockerfiles (to avoid accumulating layer sizes)
>  Restructure cassandra-ubuntu-test (only) 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) Clean apt caches in-layer in same RUN layer
> 3)  Fold venv chmod/cleanup into same RUN layers
> Each Python virtualenv was built in one layer, then a later `RUN chmod -R 
> og+wx` and `RUN rm` touched the whole tree in separate layers. Under overlay2 
> a chmod copy-up rewrites every touched file into the new layer while the 
> originals still occupy the earlier layer, so the ~2GB of virtualenvs were 
> effectively stored twice; the separate `rm` of the cassandra-driver .git dirs 
> reclaimed nothing. Consolidate each env's virtualenv creation, pip install, 
> cassandra-driver/.git removal and og+wx chmod into a single RUN so the tree 
> exists in exactly one layer with the correct permissions. No functional 
> change: same tools, versions and permissions.



--
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