Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save the planet 1/2: don't copy odoo/src in every dev images, it's already mounted! #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rvalyi
Copy link
Member

@rvalyi rvalyi commented Aug 14, 2023

This PR improves the developer experience in the dev mode of Docky

back in the early Docky versions we were doing it right and more recently somebody screwed it. Basically /odoo/src will already be a mounted volume when running Docky (docky run) so Odoo source code will be be available as expected.

The only thing we need in the build phase of the Dockerfile is just enough of Odoo metadata to get the next pip install lines to run:

RUN --mount=type=cache,target=/root/.cache pip install -e /odoo/src
COPY ./requirements.txt /odoo/
RUN --mount=type=cache,target=/root/.cache pip install -r /odoo/requirements.txt

And this is exactly the just enough files I copied in the 5 lines before in this PR!

You can test with docky build it locally. In the best case before you were copying around 250 Mb of Odoo files if you were a git-autoshare ninja and had just an odoo shallow clone in your odoo/src. But I guess many of us, in fact had full blown odoo clones in odoo/src (because otherwise without git-autoshare you cannot merge a damn Odoo pull request). That is people had around 5.7 Gb of useless odoo git files in every project they were working on locally. 6 or 7 active projects you you easily kill an SSD for nothing!

cc @sebastienbeau @PierrickBrun @hparfr @bealdav @renatonlima @mbcosta

@rvalyi
Copy link
Member Author

rvalyi commented Oct 2, 2023

up @sebastienbeau @hparfr testé encore avec succès sur 4 Docky pour OpenUpgrade, ça fait une sacrée différence et ça marche niquel...

@sebastienbeau
Copy link
Member

I think it's better to improve the .dockerignore so it's will not copy useless file inside and it's will also speed the build of the context

normally we should be able to exclude a directory with some exception

@sebastienbeau
Copy link
Member

I will spend some time next month on docky to merge PR

@rvalyi
Copy link
Member Author

rvalyi commented Oct 11, 2023

@sebastienbeau I got your point about the host cache may be able to do the job currently if never cleaned up. But we yet have to prove our CI can use it properly as it is not the case currently.
Also, I still think this builder way in my PR is still valuable as it is overall more bandwidth savy if you need to deploy on a fresh host. Currently if /root/cache is not ready you start a 5.6 Gb git clone download.

For us in Brazil, for onsite deployments in factories with poor Internet connections it makes a big difference for instance. I also doubt the /root/cache strategy has any better performance when things are cached.

@rvalyi
Copy link
Member Author

rvalyi commented Oct 18, 2023

I think it's better to improve the .dockerignore so it's will not copy useless file inside and it's will also speed the build of the context

normally we should be able to exclude a directory with some exception

For the record, I'm not sure using dockerignore would be any better: indeed the same dockerignore file would be used both for production and development and in production we will want to have the Odoo src in the image while we want to mount it for development.

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