在 Dockerfile 中将 ASP.Net 5.0 版本固定到 'beta4'
Pin ASP.Net 5.0 version to 'beta4' in Dockerfile
在 ASP.NET 5.0 beta 5 发布之前,我在 Docker 容器中有一个可用的 beta 4 应用程序 运行,其中包含以下 Docker 文件:
FROM microsoft/aspnet:1.0.0-beta4
# Install NPM
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
# Install bower and grunt
RUN npm install -g bower
RUN npm install -g grunt-bower-cli
RUN npm install -g grunt
RUN npm install -g grunt-cli
RUN npm install -g grunt-bower-task
# Install Git (for bower)
RUN apt-get -y install git
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
WORKDIR ./src/myapp
RUN ["npm", "install"]
RUN ["bower", "install", "--allow-root"]
RUN ["grunt", "bower_concat"]
RUN ["grunt", "prod"]
EXPOSE 5000
ENTRYPOINT sleep 99999999 | dnx . kestrel
但是,在 运行 现在(自 beta 5 发布以来),我得到以下异常:
System.InvalidOperationException: No service for type 'Microsoft.Framework.Runtime.IApplicationEnvironment' has been registered.
我认为这与 https://github.com/aspnet/Home/issues/588 是同一个问题,但我不知道如何在此设置中 'pin' 将版本升级到 beta 4。
这原来是 project.json
而不是 Dockerfile 的问题:
"dependencies": {
"Kestrel": "1.0.0-*",
...
}
更改为以下使其再次工作:
"dependencies": {
"Kestrel": "1.0.0-beta4",
...
}
在 ASP.NET 5.0 beta 5 发布之前,我在 Docker 容器中有一个可用的 beta 4 应用程序 运行,其中包含以下 Docker 文件:
FROM microsoft/aspnet:1.0.0-beta4
# Install NPM
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
# Install bower and grunt
RUN npm install -g bower
RUN npm install -g grunt-bower-cli
RUN npm install -g grunt
RUN npm install -g grunt-cli
RUN npm install -g grunt-bower-task
# Install Git (for bower)
RUN apt-get -y install git
COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
WORKDIR ./src/myapp
RUN ["npm", "install"]
RUN ["bower", "install", "--allow-root"]
RUN ["grunt", "bower_concat"]
RUN ["grunt", "prod"]
EXPOSE 5000
ENTRYPOINT sleep 99999999 | dnx . kestrel
但是,在 运行 现在(自 beta 5 发布以来),我得到以下异常:
System.InvalidOperationException: No service for type 'Microsoft.Framework.Runtime.IApplicationEnvironment' has been registered.
我认为这与 https://github.com/aspnet/Home/issues/588 是同一个问题,但我不知道如何在此设置中 'pin' 将版本升级到 beta 4。
这原来是 project.json
而不是 Dockerfile 的问题:
"dependencies": {
"Kestrel": "1.0.0-*",
...
}
更改为以下使其再次工作:
"dependencies": {
"Kestrel": "1.0.0-beta4",
...
}