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

uv build panicing @ the modal disco in src/commands/build.rs #7346

Closed
anthonycorletti opened this issue Sep 12, 2024 · 1 comment · Fixed by #7362
Closed

uv build panicing @ the modal disco in src/commands/build.rs #7346

anthonycorletti opened this issue Sep 12, 2024 · 1 comment · Fixed by #7362
Assignees
Labels
bug Something isn't working

Comments

@anthonycorletti
Copy link

Hello!

I experienced an interesting quirk when I was building images on Modal (modal.com). uv build fails during image creation when I define an image like so:

# here's the definition
image = (
    Image.debian_slim()
    .pip_install("uv")
    .copy_local_file("pyproject.toml", "/pyproject.toml")
    .copy_local_file("uv.lock", "/uv.lock")
    .env({"UV_PROJECT_ENVIRONMENT": "/usr/local"})
    .run_commands(
        [
            "uv sync --frozen --compile-bytecode",
            "uv build",
        ]
    )
)
# here's the error 
=> Step 2: RUN uv build
thread 'main' panicked at /home/runner/work/uv/uv/crates/uv/src/commands/build.rs:351:45:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Terminating task due to error: failed to run builder command "uv build"

Caused by:
    container exit status: 101
╭─ Error ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Image build for im-WkUYKdIswH3MiW8mLDbyFN failed with the exception:                                                                                                                                                      │
│ task exited with failure, status = exit status: 1                                                                                                                                                                         │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

the fix was adding a workdir for modal's image container builder. not sure why.

image = (
    Image.debian_slim()
    .pip_install("uv")
    .workdir("/work") # <= work work work work work
    .copy_local_file("pyproject.toml", "/work/pyproject.toml")
    .copy_local_file("uv.lock", "/work/uv.lock")
    .env({"UV_PROJECT_ENVIRONMENT": "/usr/local"})
    .run_commands(
        [
            "uv sync --frozen --compile-bytecode",
            "uv build",
        ]
    )
)

if you'd like to view some of the example code I was using to test this, ive posted the example code here: https://github.com/anthonycorletti/modal-asgi-lifecycle-example/blob/main/app/_modal.py

not sure if this is recommended. lmk if im doing something incorrectly. thanks for all the work you do!

cc @thundergolfer

@charliermarsh
Copy link
Member

We use the current working directory name there, but we can make it robust to that being empty -- it's just for logging / debugging. I'll fix it tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants