我正在尝试将Docker映像从Docker Hub部署到Rancher。当我这样做时,我只会得到更新状态,然后过一会儿,就会得到部署超时。我是Rancher的新手,正尝试浏览文档,但无法正确理解文档。谁能帮助我做到这一点?
我已经尝试拉出图像,一段时间后它显示“部署没有最低可用性”。
以下是我的.gitlab-ci.yml文件配置:
stages:
- build
- publish
.build: &build_template
stage: build
image: microsoft/dotnet:2.2-sdk-alpine
cache:
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME"
paths:
- .nuget/
script:
- dotnet restore -s https://api.nuget.org/v3/index.json --packages ./.nuget/
- dotnet publish --no-restore -c Release -o ./docker/publish/
develop_build:
<<: *build_template
only:
- develop
artifacts:
expire_in: 1 day
paths:
- docker/
.docker: &docker_template
stage: publish
image: docker:stable-dind
script:
- mkdir docker/app/
- mv docker/publish/$ASSEMBLY_NAME.* docker/app/
- mv docker/publish/*.config docker/app/
- mv docker/publish/*.json docker/app/
- cp Dockerfile docker/
- docker build -t $TAG ./docker/
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $TAG
develop_docker:
<<: *docker_template
only:
- develop
dependencies:
- develop_build
variables:
ASSEMBLY_NAME: app
TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_PIPELINE_ID
以下是我的DockerFile:
# Dockerfile
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers set
COPY ./DataStore/DataStore/*.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY *[^.csproj] ./
RUN dotnet publish -c Release -o out
# Build runtime images
FROM microsoft/dotnet:aspnetcore-runtime
ENTRYPOINT ["dotnet", "DataStore.dll"]
我想在将C#Web API部署到Rancher后运行它。