gpt4 book ai didi

docker - .gitlab-ci.yml 错误 : "apk: command not found"

转载 作者:行者123 更新时间:2023-12-01 09:57:52 31 4
gpt4 key购买 nike

我有以下 .gitlab-ci.yml 文件:

image: docker

services:
- docker:dind

stages:
- test
- build
- deploy

test:
stage: test
before_script:
- apk add --update -y python-pip
- pip install docker-compose
script:
- echo "Testing the app"
- docker-compose run app sh -c "python manage.py test && flake8"

build:
stage: build
only:
- develop
- production
- feature/deploy-debug-gitlab
before_script:
- apk add --update -y python-pip
- pip install docker-compose
script:
- echo "Building the app"
- docker-compose build

deploy:
stage: deploy
only:
- master
- develop
- feature/deploy
- feature/deploy-debug-gitlab
before_script:
- apk add --update -y python-pip
- pip install docker-compose
script:
- echo "Deploying the app"
- docker-compose up -d
environment: production
when: manual


当 Gitlab 运行程序执行它时,我收到以下错误:
$ apk add --update -y python-pip
bash: line 82: apk: command not found
ERROR: Job failed: exit status 1

我应该如何安装apk?或者 docker 以外的其他图片我应该用来运行这个 gitlab-ci.yml文件?

最佳答案

好吧,事实证明我有两个不同的运行器:一个标记为“shell executor”(Ubuntu),另一个标记为“docker executor”。

仅当 Ubuntu 运行程序调度作业时,才会抛出此错误,因为 Ubuntu 不附带 apk。

我禁用了 Ubuntu 运行器并解决了问题。

关于docker - .gitlab-ci.yml 错误 : "apk: command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56384262/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com