Skip to content

Commit 21ef59b

Browse files
committed
Initial scaffold
1 parent 7ce3e97 commit 21ef59b

11 files changed

+253
-0
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.project
6+
**/.settings
7+
**/.toolstarget
8+
**/.vs
9+
**/.vscode
10+
**/.idea
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

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
bin/
3+
obj/
4+
/packages/
5+
riderModule.iml
6+
/_ReSharper.Caches/
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DialogportenAdapter", "src\DialogportenAdapter\DialogportenAdapter.csproj", "{B1D4ADAD-3176-4C3E-A0D2-E313792587CA}"
4+
EndProject
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{530DD6C7-2F29-4B27-9FEE-0F2612F5391B}"
6+
ProjectSection(SolutionItems) = preProject
7+
docker-compose.yml = docker-compose.yml
8+
EndProjectSection
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DialogportenAdapter.Interface", "src\DialogportenAdapter.Interface\DialogportenAdapter.Interface.csproj", "{62EFCB3C-3C4D-418B-A4DD-DC1011AF8469}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{B1D4ADAD-3176-4C3E-A0D2-E313792587CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{B1D4ADAD-3176-4C3E-A0D2-E313792587CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{B1D4ADAD-3176-4C3E-A0D2-E313792587CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{B1D4ADAD-3176-4C3E-A0D2-E313792587CA}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{62EFCB3C-3C4D-418B-A4DD-DC1011AF8469}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{62EFCB3C-3C4D-418B-A4DD-DC1011AF8469}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{62EFCB3C-3C4D-418B-A4DD-DC1011AF8469}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{62EFCB3C-3C4D-418B-A4DD-DC1011AF8469}.Release|Any CPU.Build.0 = Release|Any CPU
26+
EndGlobalSection
27+
EndGlobal

docker-compose.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
dialogportenadapter:
3+
image: dialogportenadapter
4+
build:
5+
context: .
6+
dockerfile: src/DialogportenAdapter/Dockerfile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<OutputType>Library</OutputType>
6+
<PackageId>Altinn.Platform.DialogportenAdapter.Interface</PackageId>
7+
<Nullable>enable</Nullable>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
10+
11+
<PackageTags>Altinn;Platform;Dialogporten;Models</PackageTags>
12+
<Description>
13+
This class library holds the models exposed by the external endpoints of the Altinn 3 Dialogporten adapter component.
14+
</Description>
15+
<Authors>Altinn Platform Contributors</Authors>
16+
<RepositoryType>git</RepositoryType>
17+
<RepositoryUrl>https://github.com/Altinn/altinn-dialogporten-adapter</RepositoryUrl>
18+
<IncludeSymbols>true</IncludeSymbols>
19+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
20+
<IsPackable>true</IsPackable>
21+
<MinVerTagPrefix>DialogportenAdapter.Interface-</MinVerTagPrefix>
22+
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<Folder Include="Enums\" />
27+
<Folder Include="Models\" />
28+
</ItemGroup>
29+
30+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10"/>
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<Content Include="..\.dockerignore">
17+
<Link>.dockerignore</Link>
18+
</Content>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<ProjectReference Include="..\DialogportenAdapter.Interface\DialogportenAdapter.Interface.csproj" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<Folder Include="Clients\" />
27+
<Folder Include="Controllers\" />
28+
<Folder Include="Migrations\" />
29+
<Folder Include="Models\" />
30+
<Folder Include="Repositories\" />
31+
<Folder Include="Services\" />
32+
</ItemGroup>
33+
34+
</Project>

src/DialogportenAdapter/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
2+
USER $APP_UID
3+
WORKDIR /app
4+
EXPOSE 8080
5+
EXPOSE 8081
6+
7+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
8+
ARG BUILD_CONFIGURATION=Release
9+
WORKDIR /src
10+
COPY ["DialogportenAdapter/DialogportenAdapter.csproj", "DialogportenAdapter/"]
11+
RUN dotnet restore "DialogportenAdapter/DialogportenAdapter.csproj"
12+
COPY . .
13+
WORKDIR "/src/DialogportenAdapter"
14+
RUN dotnet build "DialogportenAdapter.csproj" -c $BUILD_CONFIGURATION -o /app/build
15+
16+
FROM build AS publish
17+
ARG BUILD_CONFIGURATION=Release
18+
RUN dotnet publish "DialogportenAdapter.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
19+
20+
FROM base AS final
21+
WORKDIR /app
22+
COPY --from=publish /app/publish .
23+
ENTRYPOINT ["dotnet", "DialogportenAdapter.dll"]

src/DialogportenAdapter/Program.cs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add services to the container.
4+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
5+
builder.Services.AddEndpointsApiExplorer();
6+
builder.Services.AddSwaggerGen();
7+
8+
var app = builder.Build();
9+
10+
// Configure the HTTP request pipeline.
11+
if (app.Environment.IsDevelopment())
12+
{
13+
app.UseSwagger();
14+
app.UseSwaggerUI();
15+
}
16+
17+
app.UseHttpsRedirection();
18+
19+
var summaries = new[]
20+
{
21+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
22+
};
23+
24+
app.MapGet("/weatherforecast", () =>
25+
{
26+
var forecast = Enumerable.Range(1, 5).Select(index =>
27+
new WeatherForecast
28+
(
29+
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
30+
Random.Shared.Next(-20, 55),
31+
summaries[Random.Shared.Next(summaries.Length)]
32+
))
33+
.ToArray();
34+
return forecast;
35+
})
36+
.WithName("GetWeatherForecast")
37+
.WithOpenApi();
38+
39+
app.Run();
40+
41+
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
42+
{
43+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:17207",
8+
"sslPort": 44369
9+
}
10+
},
11+
"profiles": {
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": true,
16+
"launchUrl": "swagger",
17+
"applicationUrl": "http://localhost:5195",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
},
22+
"https": {
23+
"commandName": "Project",
24+
"dotnetRunMessages": true,
25+
"launchBrowser": true,
26+
"launchUrl": "swagger",
27+
"applicationUrl": "https://localhost:7211;http://localhost:5195",
28+
"environmentVariables": {
29+
"ASPNETCORE_ENVIRONMENT": "Development"
30+
}
31+
},
32+
"IIS Express": {
33+
"commandName": "IISExpress",
34+
"launchBrowser": true,
35+
"launchUrl": "swagger",
36+
"environmentVariables": {
37+
"ASPNETCORE_ENVIRONMENT": "Development"
38+
}
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}

0 commit comments

Comments
 (0)