Skip to content

Altering editable sources when building a docker image #12681

Open
@gibsondan

Description

@gibsondan

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:

  • Copy in all the packages from elsewhere into the repo into the folder with the Dockerfile
  • pip install them all together editably

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:

[tool.uv.sources]
dagster-test = { path = '/Users/dgibson/dagster/python_modules/dagster-test', editable = true }
dagster-graphql = { path = '/Users/dgibson/dagster/python_modules/dagster-graphql', editable = true }

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for clarification or support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions