我得到了下面的gitlab CI文件,但是它停留在“创建一个优化的生产构建.”上。
我尝试在本地构建相同的文件,构建在15分钟内完成。
我在这里做错什么了?
image: docker:18.09.7
stages:
- build
- create-docker
- deploy
variables:
DOCKER_USER: 'xxx'
DOCKER_PASSWORD: 'xxx'
CI_REGISTRY: https://index.docker.io/v1/
build:
image: node:8.16.1
stage: build
script:
- npm install
- npm run build --verbose
artifacts:
when: always
expire_in: 12 hour
paths:
- build
allow_failure: true
create_docker_python:
image: docker:18.09.7
stage: create-docker
services:
- docker:18.09.7-dind
variables:
APP_IMAGE: xyz/image:1.13
script:
- docker login $CI_REGISTRY -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker build -t $APP_IMAGE -f Dockerfile . && echo "Publishing docker image on $image"
- docker push $APP_IMAGE
kube_deploy:
before_script:
- export KUBECONFIG=configFiles/admin.conf
stage: deploy
image: lwolf/helm-kubectl-docker:v152_213
script:
- kubectl delete ing backend
- kubectl delete cm file-configmap
- kubectl delete deployment saas
- kubectl apply -f folder1/k8s/ingress.yaml --validate=false
- kubectl apply -f folder1/k8s/k8s-deployment.yaml --validate=false
- kubectl apply -f folder1/k8s/k8s-configmaps.yaml --validate=false发布于 2020-03-24 13:36:30
如果您的应用程序很重,它将需要更多的资源,而且gitlab共享运行程序是不够的,您将不得不使用一个专用的运行程序。
为了解决这个问题,我增加了RAM。我购买了一个使用16 in内存的数字海洋服务器,并执行了npm run build,或者在您的CI/CD管道中使用专用转轮,您可以按照以下步骤操作
安装gitlab runner
你可以跟着这个向导走。
https://about.gitlab.com/blog/2016/04/19/how-to-set-up-gitlab-runner-on-digitalocean/
在增加RAM后,我的构建在15分钟内完成。
发布于 2022-11-10 08:54:25
在我的例子中,我们使用的是一个启用缓存的共享运行程序,这是一种反模式,因为增加资源和交换都不能解决这个问题。
如果增加资源无助于考虑:
.gitlab-ci.yml文件:default:
tags: [ your-tag-associated-with-specified-runner ]欲知更多详情,请参阅:
https://docs.gitlab.com/ee/ci/caching/index.html
的
https://stackoverflow.com/questions/58888763
复制相似问题