Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2278
Closed
Open
Issue created Mar 02, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][C#]Dockerfile generated by the aspnetcore generator can't be built

Created by: kemokemo

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The operation docker build fails with the Dockerfile generated the aspnetcore generator.

openapi-generator version

4.0.0-SNAPSHOT

The digest value of the docker image is below:

Digest: sha256:f95fdf8e4995a25f836ee769a229013e805a71cf2722b02b5f02df8182ef0406

OpenAPI declaration file content or url

https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml

Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
             -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
             -g aspnetcore \
             -o /local/out/aspnetcore
Steps to reproduce
cd out/aspnetcore/src/Org.OpenAPITools/
docker build -t org.openapitools .

Some of the results are listed below.

Step 4/11 : COPY *.csproj ./
 ---> 29633697787c
Step 5/11 : RUN dotnet restore
 ---> Running in befb7dedaa47
/usr/share/dotnet/sdk/2.1.202/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [/app/Org.OpenAPITools.csproj]
The command '/bin/sh -c dotnet restore' returned a non-zero code: 1
Related issues/PRs

#2281

Suggest a fix

It is described in the microsoft/aspnetcore-build registry as follows. It seems to require a migration.

Latest images for 2.1 and newer are now available on microsoft/dotnet. See this link for more details about migrating to 2.1.

Current Upgrade
microsoft/aspnetcore:1.0
microsoft/aspnetcore:1.1
microsoft/aspnetcore:2.0
microsoft/dotnet:2.1-aspnetcore-runtime
microsoft/aspnetcore-build:1.0
microsoft/aspnetcore-build:1.1
microsoft/aspnetcore-build:2.0
microsoft/dotnet:2.1-sdk

I will post a PR. 😃

Assignee
Assign to
Time tracking