Skip to content
This repository was archived by the owner on Feb 13, 2019. It is now read-only.

Update docker file template for core #724

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions templates/Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<% if(!coreclr){ %>FROM microsoft/aspnet:1.0.0-rc1-update1<% } %><% if(coreclr){ %>FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr<% } %>
<% if(!coreclr){ %>FROM microsoft/dotnet<% } %><% if(coreclr){ %>FROM microsoft/dotnet:core<% } %>

RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
#Set urls and port environments
ENV ASPNETCORE_URLS="http://*:5000"
Copy link

@DavidRouyer DavidRouyer May 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV ASPNETCORE_SERVER.URLS instead of ENV ASPNETCORE_URLS?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidRouyer
I think the variable is correct, they key is "ASPNETCORE_{VALUE}":
https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting.Abstractions/WebHostDefaults.cs
The ASPNETCORE_URLS is not documented, but its full support is coming: aspnet/Hosting@e7b8c3f

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterblazejewicz Alright, this is post-RC2 stuff then! For RC2, "ASPNETCORE_URLS" doesn't work.

Copy link
Member

@peterblazejewicz peterblazejewicz May 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically no templates are able to use ASPNETCORE_URLS AFAIK. I've hit that problem previously:

The -p option is supported in dotnet-cli but --server-urls support needs to be determined
#715

The solution is to modify web application startup either by:

The first blog post about RC2 + Docker also has to use that implementation: http://laurentkempe.com/2016/05/16/ASP-NET-Core-RC2-Docker-and-HipChat-Connect-add-on/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current templates are missing the configuration part with environment variables.
For RC2, I added :
var config = new ConfigurationBuilder().AddEnvironmentVariables("ASPNETCORE_").Build(); and .UseConfiguration(config) in Program.cs, and ENV ASPNETCORE_SERVER.URLS="http://*:5000" in my Dockerfile and it works just fine! Looks like I'll have to use ENV ASPNETCORE_URLS="http://*:5000" post-RC2.

ENV ASPNETCORE_ENVIRONMENT="Development"

COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]
RUN ["dotnet", "restore"]

EXPOSE 5000/tcp
ENTRYPOINT ["dnx", "-p", "project.json", "Microsoft.AspNet.Server.Kestrel", "--server.urls", "http://0.0.0.0:5000"]
EXPOSE 5000
ENTRYPOINT ["dotnet", "run"]
4 changes: 2 additions & 2 deletions test/subgenerators.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ describe('Subgenerators without arguments tests', function() {
var filename = 'Dockerfile';
util.goCreate(filename);
util.fileCheck('should create Dockerfile', filename);
util.fileContentCheck(filename, 'Check the content for Mono-based image tag', /FROM microsoft\/aspnet:1\.0\.0-rc1-update1/);
util.fileContentCheck(filename, 'Check the content for Mono-based image tag', /FROM microsoft\/dotnet/);
});

describe('aspnet:Dockerfile CoreCLR-based', function() {
var arg = '--coreclr';
var filename = 'Dockerfile';
util.goCreateWithArgs(filename, [arg]);
util.fileCheck('should create Dockerfile', filename);
util.fileContentCheck(filename, 'Check the content for CoreCLR-based image tag', /FROM microsoft\/aspnet:1\.0\.0-rc1-update1-coreclr/);
util.fileContentCheck(filename, 'Check the content for CoreCLR-based image tag', /FROM microsoft\/dotnet:core/);
});

describe('aspnet:nuget', function() {
Expand Down