-
Notifications
You must be signed in to change notification settings - Fork 290
Facilitate docker 'layering' #1652
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
Comments
Thanks for the issue, seems like something we should facilitate @pavelzw could you chime in here with your experience? |
Hmm, I get the advantage of this, although i'm worrying a bit that this makes the CLI more complicated and cluttered. I can't think of any better solution than Olivier's so I guess this could make sense in pixi... Side note: i've not really used path dependencies because of #1046 and #1340 (comment) With the FROM ghcr.io/prefix-dev/pixi
WORKDIR /app
COPY pixi.lock pixi.toml .
RUN pixi install --locked
COPY pyproject.toml my_app .
RUN pixi run postinstall But since postinstall could be considered a hack as well, this might not be what we want. |
Thanks @pavelzw for your thoughts on this! As additional background, looking at other tools:
conda and pip options are a bit different from what is proposed here, which can be explained by the fact they do not use lockfiles. Poetry's |
With I believe
I don't see why |
@ruben-arts I agree on the lower usefulness of —no-deps. This tends to be done to bypass costly checks, and/or defer the installation of dependencies to a later step/stage. |
I am not sure using the same command Maybe a separate command for package level operation would be better ? e.g. |
Hello, just checking back in to see if there have been any updates on this front. I think that separating out the dependencies installation step from the actual app installation could greatly facilitate development for containerised workflows (and this is a fairly common use case). |
I have created a PR that intends to solve this issue. Let me know what you guys think. |
Problem description
To speed up docker image building, it is fairly typical to separate "things that change often", to "things that don't".
For dependency management, this usually means it is recommended to install dependencies in a docker layer first (as they do not change often), then install the local package(s) (as it changes at ~each build, so a lot more often).
A very simple python Dockerfile may look like
where requirements are installed before copying local code, to maximise cache hit.
It is not clear how something similar could be achieved with pixi currently. A couple of options that come to mind
Another alternative (and better?) option could be extra options for pixi install. For instance
--no-path-dependencies
and--only-path-dependencies
to respectively exclude path dependencies from solve & install, or deal only with them (ideally without doing any solve work, bypassing as many steps as possible to speed things up).The Dockerfile may then look like
The text was updated successfully, but these errors were encountered: