我正在尝试使用 buildx 在 github 操作文件中构建 compose 文件,但出现下一个错误:
[104392] Failed to execute script docker-compose
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 203, in perform_command
File "compose/metrics/decorator.py", line 18, in wrapper
File "compose/cli/main.py", line 380, in build
File "compose/project.py", line 519, in build
File "compose/project.py", line 501, in build_service
File "compose/service.py", line 1133, in build
File "compose/service.py", line 1950, in build
IndexError: list index out of range
Error: Process completed with exit code 255.
在错误出现之前,所有 Dockerfile 步骤都在构建堆栈步骤中正确完成,之后应该开始图像导出。
当我尝试在 _work 目录下的一个节点中部署的 github 运行器中运行相同的命令时,我没有任何错误。
当我从 github 操作 yaml 文件中删除 setup buildx 步骤时,错误没有出现。
这是 integration.yaml(github 操作):
name: Continuous Integration
on:
pull_request:
branches: '*'
jobs:
integration:
name: Setup Docker
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
driver-opts: >-
image=moby/buildkit:master
- name: Cache main image layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Prepare environment
run: |
cp .npmrc.example .npmrc
cp .env.example .env
- name: Build stack
run: |
DOCKER_BUILDKIT=1 ./devops ci build --no-cache --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) app
devops 脚本基本上是在执行下一个命令:
docker-compose -f docker-compose.yml -f .docker/overrides/docker-compose.ci.yml build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) app
这可能与我在 docker-compose 文件中定义的一些标签有关吗?
我将不胜感激,因为我没有发现与此相关的任何其他问题。
谢谢 :)