我有以下heroku.yml
build:
config:
ASPNETCORE_ENVIRONMENT: Development
docker:
api: Dockerfile.api.heroku
使用以下Dockerfile.api.heroku
# horizon.api
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY /api/horizon.api.v1/horizon.api.v1.csproj api/horizon.api.v1/
COPY ["clients/shared/horizon.shared/horizon.shared.csproj", "clients/shared/horizon.shared/"]
RUN dotnet restore api/horizon.api.v1/horizon.api.v1.csproj
COPY . .
WORKDIR /src/api/horizon.api.v1
RUN dotnet build horizon.api.v1.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish horizon.api.v1.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "horizon.api.v1.dll"]
我提交,然后推送到heroku,看起来一切正常……直到最后一秒钟推送容器失败。
remote: Step 17/18 : COPY --from=publish /app .
remote: ---> ecb31184e304
remote: Step 18/18 : ENTRYPOINT ["dotnet", "horizon.api.v1.dll"]
remote: ---> Running in 6e07ffc427b2
remote: Removing intermediate container 6e07ffc427b2
remote: ---> d9495a8e4210
remote: Successfully built d9495a8e4210
remote: Successfully tagged ce67edde6369fde77979ae78e46a5dbd35deb17e:latest
remote:
remote: === Pushing api (Dockerfile.api.heroku)
remote: Tagged image "ce67edde6369fde77979ae78e46a5dbd35deb17e" as "registry.heroku.com/snow-horizon/api"
remote: The push refers to repository [registry.heroku.com/snow-horizon/api]
remote: 263b67a899f9: Preparing
remote: 45a1796d006a: Preparing
remote: 70f5e9fc5d77: Preparing
remote: 9c4a8a2146d7: Preparing
remote: fafa302efdfc: Preparing
remote: 0a07e81f5da3: Preparing
remote: 0a07e81f5da3: Waiting
remote: 70f5e9fc5d77: Layer already exists
remote: 9c4a8a2146d7: Layer already exists
remote: fafa302efdfc: Layer already exists
remote: 0a07e81f5da3: Layer already exists
remote: 45a1796d006a: Pushed
remote: 263b67a899f9: Pushed
remote: unsupported
remote:
remote: =!= Build failed due to an error:
remote:
remote: =!= push step: exit status 1
remote:
remote: If this persists, please contact us at https://help.heroku.com/.
remote: Verifying deploy...
remote:
remote: ! Push rejected to snow-horizon.
remote:
To https://git.heroku.com/snow-horizon.git
! [remote rejected] HEAD -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/snow-horizon.git'
如日志所示,容器可以正常构建-但是在推送容器图像层然后爆炸时会出现奇怪的“不受支持”错误。 :(
任何想法为何?该错误消息表明我去了help.heroku.com,而help.heroku.com表明我去了stackoverflow。 :)