0条评论
还没有人评论过~
配置完gitlab-ci push代码后 脚本执行没有出错 镜像构建完成 容器也成功启动 但是 无论是在宿主机 还是 gitlab-runner 中 都找不到 新的容器
.gitlab-ci.yml 文件
stages:
- build
- deploy
build-job :
stage: build
only:
- master
image: mcr.microsoft.com/dotnet/core/sdk:3.1-buster
script:
- cd WebApi/
- dotnet build
- dotnet publish -c Release -o ./publish
# artifacts:
# expire_in: 30 days
# paths:
# - publish/
artifacts:
paths:
- WebApi/publish/
deploy-job:
stage: deploy
only:
- master
image: docker:19.03.12
services:
- docker:dind
dependencies:
- build-job
script:
- cd WebApi
- cd publish/
- docker build -t rms_server:1.0 .
- docker run --name rms_server -d -p 8810:80 -v /usr/wwwroot/rms_server/wwwroot:/app/wwwroot -v /usr/wwwroot/rms_server/Configs:/app/Configs rms_server:1.0
job 结束,对应的 ci 容器就自动退出,不能在 ci 容器中起容器部署应用,建议通过 shell runner 跑 deploy-job