-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Altering editable sources when building a docker image #12681
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
Altering the Dockerfile is also entirely fair game here, but ideally it would still be using uv sync under the hood. I wouldn't be opposed to manually passing in a long list of editable overrides to the tool.uv.sources values into the uv sync command, for example. |
Can you use relative paths instead of absolute paths? Perhaps you could use a symlinked directory to the absolute paths outside the container then replace the symlink with a real directory with the packages copied in when inside the container? Do you still need them to be editable? |
I'm also struggling with this. I was able to use relative paths for tools.uv.sources... and set the docker build context to include them. But I get back to a situation where a code change in the editable packages invalidates the uv sync layer meant to just install remote packages. Seems we need a way to have uv sync filter down to just install the remote deps in one layer, the local / editable packages in a subsequent layer. |
You mean something like |
If what Charlie suggests, that'd be like #12845, e.g., |
Just to be sure I understood what you all said above. As of right now, the only way to build a dockerfile for a project referencing local packages (that are not part of the same workspace), would be to include all of these packages in the docker context when running export --frozen? |
No, if you're using |
I was getting an error of distribution not found for the local dependency. |
Question
I'm trying to build a Docker image using uv that incorporates other packages from elsewhere in a monorepo, installing them editably. These packages are not part of the Docker context where the build command is being run.
The way that I would have done this before with pip is pretty gross, but worked:
I'm struggling to map that pattern onto the Dockerfile in the uv docker example: https://github.com/astral-sh/uv-docker-example which uses uv sync and relies on tool.uv.sources to locate the editable packages.
Specifically I have a pyproject.toml that looks like this:
referencing paths outside of the Docker context.
The only option I can think of is modifying the contents of the pyproject.toml during the build to reference the new editable location after I copy it into the final folder with the Docker context.
Curious if this has come up before or if you have any other suggestions on how we might approach this. I could imagine heavy solutions like having different 'profiles' available for tool.uv.sources and being able to switch between them, but that seems like a lot.
Platform
No response
Version
No response
The text was updated successfully, but these errors were encountered: