Skip to content

Commit b6b2a32

Browse files
committed
Fixed Dockerfile
1 parent 5d98c21 commit b6b2a32

File tree

2 files changed

+50
-42
lines changed

2 files changed

+50
-42
lines changed

code/complete/GraphQL/Startup.cs

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using HotChocolate;
1616
using HotChocolate.Types;
1717
using HotChocolate.Resolvers;
18+
using HotChocolate.AspNetCore;
1819
using System.Diagnostics;
1920

2021
namespace ConferencePlanner.GraphQL
@@ -40,49 +41,49 @@ public void ConfigureServices(IServiceCollection services)
4041
// This adds the GraphQL server core service and declares a schema.
4142
.AddGraphQLServer()
4243

43-
// Next we add the types to our schema.
44-
.AddQueryType()
45-
.AddTypeExtension<AttendeeQueries>()
46-
.AddTypeExtension<SessionQueries>()
47-
.AddTypeExtension<SpeakerQueries>()
48-
.AddTypeExtension<TrackQueries>()
49-
.AddMutationType()
50-
.AddTypeExtension<AttendeeMutations>()
51-
.AddTypeExtension<SessionMutations>()
52-
.AddTypeExtension<SpeakerMutations>()
53-
.AddTypeExtension<TrackMutations>()
54-
.AddSubscriptionType()
55-
.AddTypeExtension<AttendeeSubscriptions>()
56-
.AddTypeExtension<SessionSubscriptions>()
57-
.AddType<AttendeeType>()
58-
.AddType<SessionType>()
59-
.AddType<SpeakerType>()
60-
.AddType<TrackType>()
44+
// Next we add the types to our schema.
45+
.AddQueryType()
46+
.AddTypeExtension<AttendeeQueries>()
47+
.AddTypeExtension<SessionQueries>()
48+
.AddTypeExtension<SpeakerQueries>()
49+
.AddTypeExtension<TrackQueries>()
50+
.AddMutationType()
51+
.AddTypeExtension<AttendeeMutations>()
52+
.AddTypeExtension<SessionMutations>()
53+
.AddTypeExtension<SpeakerMutations>()
54+
.AddTypeExtension<TrackMutations>()
55+
.AddSubscriptionType()
56+
.AddTypeExtension<AttendeeSubscriptions>()
57+
.AddTypeExtension<SessionSubscriptions>()
58+
.AddType<AttendeeType>()
59+
.AddType<SessionType>()
60+
.AddType<SpeakerType>()
61+
.AddType<TrackType>()
6162

62-
// In this section we are adding extensions like relay helpers,
63-
// filtering and sorting.
64-
.AddFiltering()
65-
.AddSorting()
66-
.AddGlobalObjectIdentification()
63+
// In this section we are adding extensions like relay helpers,
64+
// filtering and sorting.
65+
.AddFiltering()
66+
.AddSorting()
67+
.AddGlobalObjectIdentification()
6768

68-
// Now we add some the DataLoader to our system.
69-
.AddDataLoader<AttendeeByIdDataLoader>()
70-
.AddDataLoader<SessionByIdDataLoader>()
71-
.AddDataLoader<SpeakerByIdDataLoader>()
72-
.AddDataLoader<TrackByIdDataLoader>()
69+
// Now we add some the DataLoader to our system.
70+
.AddDataLoader<AttendeeByIdDataLoader>()
71+
.AddDataLoader<SessionByIdDataLoader>()
72+
.AddDataLoader<SpeakerByIdDataLoader>()
73+
.AddDataLoader<TrackByIdDataLoader>()
7374

74-
// we make sure that the db exists and prefill it with conference data.
75-
.EnsureDatabaseIsCreated()
75+
// we make sure that the db exists and prefill it with conference data.
76+
.EnsureDatabaseIsCreated()
7677

77-
// Since we are using subscriptions, we need to register a pub/sub system.
78-
// for our demo we are using a in-memory pub/sub system.
79-
.AddInMemorySubscriptions()
78+
// Since we are using subscriptions, we need to register a pub/sub system.
79+
// for our demo we are using a in-memory pub/sub system.
80+
.AddInMemorySubscriptions()
8081

81-
// Last we add support for persisted queries.
82-
// The first line adds the persisted query storage,
83-
// the second one the persisted query processing pipeline.
84-
.AddFileSystemQueryStorage("./persisted_queries")
85-
.UsePersistedQueryPipeline();
82+
// Last we add support for persisted queries.
83+
// The first line adds the persisted query storage,
84+
// the second one the persisted query processing pipeline.
85+
.AddFileSystemQueryStorage("./persisted_queries")
86+
.UsePersistedQueryPipeline();
8687
}
8788

8889
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -101,14 +102,21 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
101102
app.UseEndpoints(endpoints =>
102103
{
103104
// We will be using the new routing API to host our GraphQL middleware.
104-
endpoints.MapGraphQL();
105+
endpoints.MapGraphQL()
106+
.WithOptions(new GraphQLServerOptions
107+
{
108+
Tool =
109+
{
110+
GaTrackingId = "UA-72800164-1"
111+
}
112+
});
105113

106114
endpoints.MapGet("/", context =>
107115
{
108-
context.Response.Redirect("/graphql");
116+
context.Response.Redirect("/graphql", true);
109117
return Task.CompletedTask;
110118
});
111119
});
112120
}
113121
}
114-
}
122+
}

code/complete/GraphQL/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM mcr.microsoft.com/dotnet/6.0.100-preview.7-alpine3.13-amd64 AS build-env
2+
FROM mcr.microsoft.com/dotnet/sdk:6.0.100-preview.7-alpine3.13-amd64 AS build-env
33
WORKDIR /app
44

55
# Copy csproj and restore as distinct layers

0 commit comments

Comments
 (0)