admin管理员组

文章数量:1122846

I've created a Python GitHub action. It runs as a Docker container. One of its layers is the installation of some packages using uv. When I use that action from another repository, although it shows the dependencies are installed in the building step, it seems none of its dependencies are installed when it tries to use that action.

Action

Dockerfile:

FROM python:3.12-slim

# Installing uv
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /uvx /bin/

WORKDIR /action

COPY . .

# Installing the dependencies (it works)
RUN uv sync --no-install-project --no-cache

CMD [ "uv", "run", "/action/main.py" ]

The Python file (/action/main.py):

import subprocess

subprocess.call(["pip", "list"])

import requests
...

Action Usage

Here is the pipeline that I'm using from a different repository.

jobs:
  build:
    runs-on: ubuntu-latest

    name: Running the action
    steps:

      - name: Using the action
        id: my_action
        uses: me/my-action@main
        with:
          url: ";

      - name: Echo result
        run: echo ${{steps.my_action.outputs.status_code}}

Here is the error that I'm getting by running this pipeline:

I don't know what "Build me/my-action@main" step is, but in that step, the RUN uv sync --no-install-project --no-cache is executed successfully and all the requirements are installed in there, but in the "Using the action" step, there is nothing installed but pip.

I've created a Python GitHub action. It runs as a Docker container. One of its layers is the installation of some packages using uv. When I use that action from another repository, although it shows the dependencies are installed in the building step, it seems none of its dependencies are installed when it tries to use that action.

Action

Dockerfile:

FROM python:3.12-slim

# Installing uv
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /uvx /bin/

WORKDIR /action

COPY . .

# Installing the dependencies (it works)
RUN uv sync --no-install-project --no-cache

CMD [ "uv", "run", "/action/main.py" ]

The Python file (/action/main.py):

import subprocess

subprocess.call(["pip", "list"])

import requests
...

Action Usage

Here is the pipeline that I'm using from a different repository.

jobs:
  build:
    runs-on: ubuntu-latest

    name: Running the action
    steps:

      - name: Using the action
        id: my_action
        uses: me/my-action@main
        with:
          url: "https://google.com"

      - name: Echo result
        run: echo ${{steps.my_action.outputs.status_code}}

Here is the error that I'm getting by running this pipeline:

I don't know what "Build me/my-action@main" step is, but in that step, the RUN uv sync --no-install-project --no-cache is executed successfully and all the requirements are installed in there, but in the "Using the action" step, there is nothing installed but pip.

Share Improve this question asked Nov 21, 2024 at 12:07 SadraSadra 3643 silver badges12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I just double checked on my environment and RUN uv sync --no-install-project --no-cache do not install dependencies.

Seems --no-install-project flag is preventing to install any dependencies.

You could use following command, just make sure requirements.txt exists and has correct data

RUN pip install --no-cache-dir -r requirements.txt

本文标签: