这是我的GitHub Action步骤。已经创建了
这是一个在requirements.txt中包含指向私有仓库的链接,在构建Docker镜像时正在尝试安装的一行代码。
该行已经添加到
PRIVATE_REQUIREMENT_OWNER_TOKEN
密码,其中包含具有完整repo
权限的GitHub令牌。 - name: Build docker image
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
context: .
tags: 'username/image:latest'
secrets: |
"github_token=${{ secrets.PRIVATE_REQUIREMENT_OWNER_TOKEN }}"
这是一个在requirements.txt中包含指向私有仓库的链接,在构建Docker镜像时正在尝试安装的一行代码。
git+ssh://git@github.com/username/private-repository
该行已经添加到
Dockerfile
中。RUN --mount=type=secret,id=github_token pip install https://$(cat /run/secrets/github_token)@github.com/username/private-repository.git
在 GitHub Actions 中出现以下错误:
#11 [ 6/12] RUN --mount=type=secret,id=PRIVATE_REQUIREMENT_OWNER_TOKEN_SECRET pip install https://$(cat /run/secrets/PRIVATE_REQUIREMENT_OWNER_TOKEN_SECRET)@github.com/username/private-repository.git
#11 sha256:b3d88dd9813db3257b15f53f1eb5a4c593c69ff98ec03cc4d70d564df1a1f7f6
#11 0.697 Collecting https://****@github.com/vassilyvv/django-sinbad.git
#11 0.790 ERROR: HTTP error 404 while getting https://****@github.com/username/private-repository
.git
#11 0.791 ERROR: Could not install requirement https://****@github.com/username/private-repository
.git because of HTTP error 404 Client Error: Not Found for url: https://github.com/username/private-repository
for URL https://****@github.com/username/private-repository.git
但是当我尝试使用同一令牌在本地机器上克隆存储库时,它能够成功:
git clone https://<token>@github.com/username/private-repository.git
我完全不知道如何使用这个github_token
来成功克隆上面提到的私有仓库。
我的目标是在构建GitHub Actions中的Dockerfile镜像时克隆私有GitHub存储库。 我几乎确定我已经执行了一些错误的步骤。 请帮忙!
/run/secrets/github_token
是base64编码还是包含预期值的实际值? - VonC/run/secrets/github_token
中的,因为我没有成功在GH Actions日志中显示它。 - Vassily