Skip to content

Commit f6baaf6

Browse files
committed
link server files to new location, and fix dockerfile for server build
1 parent 9f861e0 commit f6baaf6

38 files changed

+85
-20
lines changed

server/Dockerfile

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
2-
WORKDIR /app
1+
# https://hub.docker.com/_/microsoft-dotnet
2+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
3+
WORKDIR /source
34

4-
# Copy csproj and restore as distinct layers
5-
COPY *.csproj ./
6-
RUN dotnet restore
5+
# copy csproj and restore as distinct layers
6+
COPY *.sln .
7+
COPY server/*.csproj ./server/
8+
RUN dotnet restore -r linux-x64
79

8-
# Copy everything else and build
9-
COPY . ./
10-
RUN dotnet publish -c Release -o out
10+
# copy everything else and build app
11+
COPY server/. ./server/
12+
WORKDIR /source/server
13+
RUN dotnet publish -c release -o /app -r linux-x64 --self-contained false --no-restore
1114

12-
# Build runtime image
13-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
15+
# final stage/image
16+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-focal-amd64
1417
WORKDIR /app
15-
COPY --from=build-env /app/out .
16-
ENTRYPOINT ["dotnet", "server.dll"]
18+
COPY --from=build /app ./
19+
ENTRYPOINT ["./server"]

server/server.sln

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27130.2027
5+
MinimumVisualStudioVersion = 15.0.26124.0
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "server", "server\server.csproj", "{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1E1C7ABA-885A-4273-811E-B66AD28F9A87}"
9+
ProjectSection(SolutionItems) = preProject
10+
.dockerignore = .dockerignore
11+
aspnet-docker-dev-in-container.md = aspnet-docker-dev-in-container.md
12+
aspnetcore-docker-arm32.md = aspnetcore-docker-arm32.md
13+
aspnetcore-docker-arm64.md = aspnetcore-docker-arm64.md
14+
deploy-container-to-aci.md = deploy-container-to-aci.md
15+
Directory.Build.props = Directory.Build.props
16+
Dockerfile = Dockerfile
17+
README.md = README.md
18+
EndProjectSection
19+
EndProject
20+
Global
21+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
22+
Debug|Any CPU = Debug|Any CPU
23+
Debug|x64 = Debug|x64
24+
Debug|x86 = Debug|x86
25+
Release|Any CPU = Release|Any CPU
26+
Release|x64 = Release|x64
27+
Release|x86 = Release|x86
28+
EndGlobalSection
29+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
30+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|x64.ActiveCfg = Debug|Any CPU
33+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|x64.Build.0 = Debug|Any CPU
34+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|x86.ActiveCfg = Debug|Any CPU
35+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Debug|x86.Build.0 = Debug|Any CPU
36+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|x64.ActiveCfg = Release|Any CPU
39+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|x64.Build.0 = Release|Any CPU
40+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|x86.ActiveCfg = Release|Any CPU
41+
{5FDCC1ED-9F59-47ED-969D-5E463CDD8D52}.Release|x86.Build.0 = Release|Any CPU
42+
EndGlobalSection
43+
GlobalSection(SolutionProperties) = preSolution
44+
HideSolutionNode = FALSE
45+
EndGlobalSection
46+
GlobalSection(ExtensibilityGlobals) = postSolution
47+
SolutionGuid = {C9A7C5A2-5C90-4AD9-ABB8-6F2D2364D5AF}
48+
EndGlobalSection
49+
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

server/Program.cs renamed to server/server/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Net;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Threading.Tasks;
@@ -21,7 +22,6 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
2122
.ConfigureWebHostDefaults(webBuilder =>
2223
{
2324
webBuilder.UseStartup<Startup>();
24-
webBuilder.UseUrls("http://localhost:5000", "https://localhost:5001");
2525
});
2626
}
2727
}

server/Properties/launchSettings.json renamed to server/server/Properties/launchSettings.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
23
"iisSettings": {
34
"windowsAuthentication": false,
45
"anonymousAuthentication": true,
56
"iisExpress": {
6-
"applicationUrl": "http://localhost:50785",
7-
"sslPort": 44332
7+
"applicationUrl": "http://localhost:37762",
8+
"sslPort": 44307
89
}
910
},
1011
"profiles": {
1112
"IIS Express": {
1213
"commandName": "IISExpress",
1314
"launchBrowser": true,
15+
"launchUrl": "swagger",
1416
"environmentVariables": {
1517
"ASPNETCORE_ENVIRONMENT": "Development"
1618
}
1719
},
1820
"server": {
1921
"commandName": "Project",
22+
"dotnetRunMessages": "true",
2023
"launchBrowser": true,
24+
"launchUrl": "swagger",
2125
"applicationUrl": "https://localhost:5001;http://localhost:5000",
2226
"environmentVariables": {
2327
"ASPNETCORE_ENVIRONMENT": "Development"
File renamed without changes.

server/Startup.cs renamed to server/server/Startup.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.Extensions.Hosting;
1212
using Microsoft.Extensions.Logging;
1313
using Microsoft.OpenApi.Models;
14+
using Microsoft.AspNetCore.Http;
1415

1516
namespace server
1617
{
@@ -30,7 +31,12 @@ public void ConfigureServices(IServiceCollection services)
3031
services.AddControllers();
3132
services.AddSwaggerGen(c =>
3233
{
33-
c.SwaggerDoc("v1", new OpenApiInfo { Title = "tempp", Version = "v1" });
34+
c.SwaggerDoc("v1", new OpenApiInfo { Title = "server", Version = "v1" });
35+
});
36+
37+
services.AddHttpsRedirection(options => {
38+
options.RedirectStatusCode = StatusCodes.Status307TemporaryRedirect;
39+
options.HttpsPort = 8001;
3440
});
3541
}
3642

@@ -41,13 +47,15 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4147
{
4248
app.UseDeveloperExceptionPage();
4349
app.UseSwagger();
44-
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "tempp v1"));
50+
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "server v1"));
4551
}
4652

4753
app.UseHttpsRedirection();
4854

4955
app.UseRouting();
5056

57+
app.UseCookiePolicy();
58+
5159
app.UseAuthorization();
5260

5361
app.UseEndpoints(endpoints =>
File renamed without changes.
File renamed without changes.

server/appsettings.json renamed to server/server/appsettings.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2+
"https_port": 443,
23
"Logging": {
34
"LogLevel": {
4-
"Default": "Information",
5-
"Microsoft": "Warning",
6-
"Microsoft.Hosting.Lifetime": "Information"
5+
"Default": "Information",
6+
"Microsoft": "Warning",
7+
"Microsoft.Hosting.Lifetime": "Information"
78
}
89
},
910
"AllowedHosts": "*"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)