Skip to content

Conversation

alexander-smolyakov
Copy link
Contributor

Description:

During patch development, the CI checks for the anaconda devcontainer started to fail due to the space limit on a hosted agent.

After investigation, it turned out that layer where we set up ownership and permission for the opt folder consumes a lot of space. This is related to using of chown and chmod commands.

Related code:

RUN groupadd -r conda --gid 900 \
&& chown -R :conda /opt/conda \
&& chmod -R g+w /opt/conda \
&& find /opt -type d | xargs -n 1 chmod g+s \
&& usermod -aG conda ${USERNAME}

Fix:

To fix this and reduce image size, the Docker file was refactored:

  • The pip install and conda install commands now executes against the continuumio/anaconda3 image. This will allow us to not worry about opt folder permissions and ownership since we can set them up during COPY instruction;

  • The COPY instruction now sets up permissions and ownership for the opt folder. The COPY instruction will not create an additional layer, which should help decrease image size;

  • Previous commands for setting up permissions and ownership were removed.

@alexander-smolyakov alexander-smolyakov requested a review from a team as a code owner August 2, 2023 15:38
Copy link
Member

@samruddhikhandale samruddhikhandale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is super cool to see the image size decrease from ~9 GB to ~5 GB 🎉 ✨
Thank you!

Left some comments!

- Bump `base` devcontainer version
- Update permissions
@alexander-smolyakov alexander-smolyakov changed the title WIP: [anaconda] Refactor Dockerfile to decrease image size [anaconda] Refactor Dockerfile to decrease image size Aug 3, 2023
Copy link
Member

@samruddhikhandale samruddhikhandale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look great, thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants