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
.
1 Answer
Reset to default 0I 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
本文标签:
版权声明:本文标题:python - Docker Actions Ignore the Installed Dependencies That Are Installed During the Build Step - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736311072a1934606.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论