mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
[aspnetcore] Update Dockerfile (#7873)
* Update Dockerfile * Readd telemetry optout * Update Petstore samples
This commit is contained in:
parent
2e69e6c03e
commit
12abfb9686
@ -1,11 +1,18 @@
|
|||||||
FROM microsoft/dotnet:1.0.3-sdk-projectjson
|
FROM microsoft/aspnetcore-build:2.0 AS build-env
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
|
||||||
|
|
||||||
WORKDIR /app/{{packageName}}
|
# copy csproj and restore as distinct layers
|
||||||
COPY . /app/{{packageName}}
|
COPY *.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
EXPOSE 5000/tcp
|
# copy everything else and build
|
||||||
|
COPY . ./
|
||||||
|
RUN dotnet publish -c Release -o out
|
||||||
|
|
||||||
RUN ["dotnet", "restore"]
|
# build runtime image
|
||||||
ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"]
|
FROM microsoft/aspnetcore:2.0
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build-env /app/out .
|
||||||
|
ENTRYPOINT ["dotnet", "{{packageName}}.dll"]
|
||||||
|
@ -1 +1 @@
|
|||||||
2.4.0-SNAPSHOT
|
unset
|
@ -92,7 +92,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||||
exampleJson = "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]";
|
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||||
@ -123,7 +123,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||||
exampleJson = "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]";
|
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
|
||||||
@ -158,7 +158,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||||
@ -234,7 +234,7 @@ namespace IO.Swagger.Controllers
|
|||||||
// return StatusCode(200, default(ApiResponse));
|
// return StatusCode(200, default(ApiResponse));
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}";
|
exampleJson = "{\r\n \"code\" : 0,\r\n \"type\" : \"type\",\r\n \"message\" : \"message\"\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<ApiResponse>(exampleJson)
|
? JsonConvert.DeserializeObject<ApiResponse>(exampleJson)
|
||||||
|
@ -70,7 +70,7 @@ namespace IO.Swagger.Controllers
|
|||||||
// return StatusCode(200, default(Dictionary<string, int?>));
|
// return StatusCode(200, default(Dictionary<string, int?>));
|
||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "{\n \"key\" : 0\n}";
|
exampleJson = "{\r\n \"key\" : 0\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<Dictionary<string, int?>>(exampleJson)
|
? JsonConvert.DeserializeObject<Dictionary<string, int?>>(exampleJson)
|
||||||
@ -105,7 +105,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
||||||
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
||||||
@ -136,7 +136,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>";
|
||||||
exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}";
|
exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
? JsonConvert.DeserializeObject<Order>(exampleJson)
|
||||||
|
@ -115,7 +115,7 @@ namespace IO.Swagger.Controllers
|
|||||||
/// Get user by user name
|
/// Get user by user name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing. </param>
|
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
|
||||||
/// <response code="200">successful operation</response>
|
/// <response code="200">successful operation</response>
|
||||||
/// <response code="400">Invalid username supplied</response>
|
/// <response code="400">Invalid username supplied</response>
|
||||||
/// <response code="404">User not found</response>
|
/// <response code="404">User not found</response>
|
||||||
@ -137,7 +137,7 @@ namespace IO.Swagger.Controllers
|
|||||||
|
|
||||||
string exampleJson = null;
|
string exampleJson = null;
|
||||||
exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>";
|
exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>";
|
||||||
exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}";
|
exampleJson = "{\r\n \"firstName\" : \"firstName\",\r\n \"lastName\" : \"lastName\",\r\n \"password\" : \"password\",\r\n \"userStatus\" : 6,\r\n \"phone\" : \"phone\",\r\n \"id\" : 0,\r\n \"email\" : \"email\",\r\n \"username\" : \"username\"\r\n}";
|
||||||
|
|
||||||
var example = exampleJson != null
|
var example = exampleJson != null
|
||||||
? JsonConvert.DeserializeObject<User>(exampleJson)
|
? JsonConvert.DeserializeObject<User>(exampleJson)
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
FROM microsoft/dotnet:1.0.3-sdk-projectjson
|
FROM microsoft/aspnetcore-build:2.0 AS build-env
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
|
||||||
|
|
||||||
WORKDIR /app/IO.Swagger
|
# copy csproj and restore as distinct layers
|
||||||
COPY . /app/IO.Swagger
|
COPY *.csproj ./
|
||||||
|
RUN dotnet restore
|
||||||
|
|
||||||
EXPOSE 5000/tcp
|
# copy everything else and build
|
||||||
|
COPY . ./
|
||||||
|
RUN dotnet publish -c Release -o out
|
||||||
|
|
||||||
RUN ["dotnet", "restore"]
|
# build runtime image
|
||||||
ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"]
|
FROM microsoft/aspnetcore:2.0
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build-env /app/out .
|
||||||
|
ENTRYPOINT ["dotnet", "IO.Swagger.dll"]
|
||||||
|
@ -563,7 +563,7 @@
|
|||||||
"parameters" : [ {
|
"parameters" : [ {
|
||||||
"name" : "username",
|
"name" : "username",
|
||||||
"in" : "path",
|
"in" : "path",
|
||||||
"description" : "The name that needs to be fetched. Use user1 for testing. ",
|
"description" : "The name that needs to be fetched. Use user1 for testing.",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
} ],
|
} ],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user