Skip to content

Commit 773a455

Browse files
committed
Repository Setup
1 parent 23c5296 commit 773a455

25 files changed

+4138
-0
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
7+
8+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
9+
WORKDIR /src
10+
COPY ["Repository.csproj", "."]
11+
RUN dotnet restore "./Repository.csproj"
12+
COPY . .
13+
WORKDIR "/src/."
14+
RUN dotnet build "Repository.csproj" -c Release -o /app/build
15+
16+
FROM build AS publish
17+
RUN dotnet publish "Repository.csproj" -c Release -o /app/publish /p:UseAppHost=false
18+
19+
FROM base AS final
20+
WORKDIR /app
21+
COPY --from=publish /app/publish .
22+
ENTRYPOINT ["dotnet", "Repository.dll"]

Program.cs

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
namespace Repository
2+
{
3+
public class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
var builder = WebApplication.CreateBuilder(args);
8+
9+
// Add services to the container.
10+
builder.Services.AddAuthorization();
11+
12+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
13+
builder.Services.AddEndpointsApiExplorer();
14+
builder.Services.AddSwaggerGen();
15+
16+
var app = builder.Build();
17+
18+
// Configure the HTTP request pipeline.
19+
if (app.Environment.IsDevelopment())
20+
{
21+
app.UseSwagger();
22+
app.UseSwaggerUI();
23+
}
24+
25+
app.UseHttpsRedirection();
26+
27+
app.UseAuthorization();
28+
29+
var summaries = new[]
30+
{
31+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
32+
};
33+
34+
app.MapGet("/weatherforecast", (HttpContext httpContext) =>
35+
{
36+
var forecast = Enumerable.Range(1, 5).Select(index =>
37+
new WeatherForecast
38+
{
39+
Date = DateTime.Now.AddDays(index),
40+
TemperatureC = Random.Shared.Next(-20, 55),
41+
Summary = summaries[Random.Shared.Next(summaries.Length)]
42+
})
43+
.ToArray();
44+
return forecast;
45+
})
46+
.WithName("GetWeatherForecast");
47+
48+
app.Run();
49+
}
50+
}
51+
}

Properties/launchSettings.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"profiles": {
3+
"Repository": {
4+
"commandName": "Project",
5+
"launchBrowser": true,
6+
"launchUrl": "swagger",
7+
"environmentVariables": {
8+
"ASPNETCORE_ENVIRONMENT": "Development"
9+
},
10+
"dotnetRunMessages": true,
11+
"applicationUrl": "https://localhost:7279;http://localhost:5222"
12+
},
13+
"IIS Express": {
14+
"commandName": "IISExpress",
15+
"launchBrowser": true,
16+
"launchUrl": "swagger",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"Docker": {
22+
"commandName": "Docker",
23+
"launchBrowser": true,
24+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
25+
"publishAllPorts": true,
26+
"useSSL": true
27+
}
28+
},
29+
"$schema": "https://json.schemastore.org/launchsettings.json",
30+
"iisSettings": {
31+
"windowsAuthentication": false,
32+
"anonymousAuthentication": true,
33+
"iisExpress": {
34+
"applicationUrl": "http://localhost:28650",
35+
"sslPort": 44377
36+
}
37+
}
38+
}

Repository.csproj

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<UserSecretsId>d2b70ff5-ad3a-421b-87f1-0eba146cce8f</UserSecretsId>
8+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
<DockerfileContext>.</DockerfileContext>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
14+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
15+
</ItemGroup>
16+
17+
</Project>

Repository.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33403.182
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Repository", "Repository.csproj", "{91E4FE80-545E-4875-B333-59C74DB0A03D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{91E4FE80-545E-4875-B333-59C74DB0A03D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{91E4FE80-545E-4875-B333-59C74DB0A03D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{91E4FE80-545E-4875-B333-59C74DB0A03D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{91E4FE80-545E-4875-B333-59C74DB0A03D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {33A2F421-9E2C-4043-8715-C3C7D20B0F88}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)