Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix aspnetcore version in dockerfile #398

Merged
merged 1 commit into from
Jun 24, 2019
Merged
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
fix aspnetcore version in dockerfile
  • Loading branch information
frantuma committed Jun 24, 2019
commit ced8c3bfefb6c44b919b576c71498560e187eb6a
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ public void processOpts() {
apiTemplateFiles.put("controller.mustache", ".cs");
supportingFiles.add(new SupportingFile("Program.mustache", packageFolder, "Program.cs"));
supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, this.packageName + ".csproj"));
supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile"));
} else{
apiTemplateFiles.put("2.1/controller.mustache", ".cs");
supportingFiles.add(new SupportingFile("2.1/Program.mustache", packageFolder, "Program.cs"));
supportingFiles.add(new SupportingFile("2.1/Project.csproj.mustache", packageFolder, this.packageName + ".csproj"));
supportingFiles.add(new SupportingFile("2.1/Dockerfile.mustache", packageFolder, "Dockerfile"));
}

if (!additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
Expand All @@ -149,7 +151,6 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("build.bat.mustache", "", "build.bat"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("Solution.mustache", "", this.packageName + ".sln"));
supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile"));
supportingFiles.add(new SupportingFile("gitignore", packageFolder, ".gitignore"));
supportingFiles.add(new SupportingFile("appsettings.json", packageFolder, "appsettings.json"));

Expand Down
18 changes: 18 additions & 0 deletions src/main/resources/handlebars/aspnetcore/2.1/Dockerfile.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/core/sdk:{{aspNetCoreVersion}} AS build-env
WORKDIR /app

ENV DOTNET_CLI_TELEMETRY_OPTOUT 1

# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:{{aspNetCoreVersion}}
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "{{packageName}}.dll"]
4 changes: 2 additions & 2 deletions src/main/resources/handlebars/aspnetcore/Dockerfile.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM microsoft/aspnetcore-build:2.0 AS build-env
FROM microsoft/aspnetcore-build:{{aspNetCoreVersion}} AS build-env
WORKDIR /app

ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
Expand All @@ -12,7 +12,7 @@ COPY . ./
RUN dotnet publish -c Release -o out

# build runtime image
FROM microsoft/aspnetcore:2.0
FROM microsoft/aspnetcore:{{aspNetCoreVersion}}
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "{{packageName}}.dll"]