Skip to content

Easy method to shrink size of terra-jupyter-r #352

@sjfleming

Description

@sjfleming

The following line in the terra-jupyter-r Dockerfile is a problem:

&& chown -R $USER:users /usr/local/lib/R/site-library /home/jupyter

The chown operation itself is fine, but since it occurs at the end of the build, it actually copies the whole layer with all the R installs over again. This ends up being several GB.
For example, on a machine that has built terra-jupyter-r, try running docker history terra-jupyter-r and you will likely see something like

IMAGE          CREATED             CREATED BY                                      SIZE      COMMENT
47c09bb5034d   42 minutes ago      /bin/sh -c #(nop)  USER jupyter                 0B        
754d26234c45   42 minutes ago      |1 NCPU=16 /bin/sh -c R -e 'IRkernel::instal…   3.76GB    
...
250ffdaacc93   42 minutes ago      |1 NCPU=16 /bin/sh -c R -e 'BiocManager::ins…   3.76GB   
...

Changing the permissions on /usr/local/lib/R/site-library after all the installs ends up copying all the massive layers that went into that folder (all the package installs).

Proposal:
Move the chown on line 177

&& chown -R $USER:users /usr/local/lib/R/site-library /home/jupyter

up above all the R installs... perhaps to line 111.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions