Ionut commited on
Commit
c07511c
1 Parent(s): f10b3df

Build docker file

Browse files
.dockerignore ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
+ !**/.gitignore
27
+ !.git/HEAD
28
+ !.git/config
29
+ !.git/packed-refs
30
+ !.git/refs/heads/**
Dockerfile CHANGED
@@ -1,16 +1,24 @@
1
- FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
2
- # current folder
3
- WORKDIR /
4
 
5
- # Copy everything
6
- COPY . ./
7
- # Restore as distinct layers
8
- RUN dotnet restore
9
- # Build and publish a release
10
- RUN dotnet publish -c Release -o out
11
 
12
- # Build runtime image
13
- FROM mcr.microsoft.com/dotnet/aspnet:8.0
14
- WORKDIR /
15
- COPY --from=build-env /out .
 
 
 
 
 
 
 
 
 
 
 
 
16
  ENTRYPOINT ["dotnet", "QuotesAPI.dll"]
 
 
 
 
1
 
2
+ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
3
+ USER app
4
+ WORKDIR /app
5
+ EXPOSE 8080
6
+ EXPOSE 8081
 
7
 
8
+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
9
+ ARG BUILD_CONFIGURATION=Release
10
+ WORKDIR /src
11
+ COPY ["QuotesAPI.csproj", "."]
12
+ RUN dotnet restore "./QuotesAPI.csproj"
13
+ COPY . .
14
+ WORKDIR "/src/."
15
+ RUN dotnet build "./QuotesAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
16
+
17
+ FROM build AS publish
18
+ ARG BUILD_CONFIGURATION=Release
19
+ RUN dotnet publish "./QuotesAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
20
+
21
+ FROM base AS final
22
+ WORKDIR /app
23
+ COPY --from=publish /app/publish .
24
  ENTRYPOINT ["dotnet", "QuotesAPI.dll"]
Dockerfile.original ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
2
+ # current folder
3
+ WORKDIR /
4
+
5
+ # Copy everything
6
+ COPY . ./
7
+ # Restore as distinct layers
8
+ RUN dotnet restore
9
+ # Build and publish a release
10
+ RUN dotnet publish -c Release -o out
11
+
12
+ # Build runtime image
13
+ FROM mcr.microsoft.com/dotnet/aspnet:8.0
14
+ WORKDIR /
15
+ COPY --from=build-env /out .
16
+ ENTRYPOINT ["dotnet", "QuotesAPI.dll"]
Properties/launchSettings.json CHANGED
@@ -1,25 +1,36 @@
1
- {
2
- "$schema": "http://json.schemastore.org/launchsettings.json",
3
  "profiles": {
4
  "http": {
5
  "commandName": "Project",
6
- "dotnetRunMessages": true,
7
  "launchBrowser": true,
8
  "launchUrl": "swagger",
9
- "applicationUrl": "http://localhost:7001",
10
  "environmentVariables": {
11
  "ASPNETCORE_ENVIRONMENT": "Development"
12
- }
 
 
13
  },
14
  "https": {
15
  "commandName": "Project",
16
- "dotnetRunMessages": true,
17
  "launchBrowser": true,
18
  "launchUrl": "swagger",
19
- "applicationUrl": "https://localhost:7000;http://localhost:7001",
20
  "environmentVariables": {
21
  "ASPNETCORE_ENVIRONMENT": "Development"
22
- }
 
 
23
  },
24
- }
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
 
2
  "profiles": {
3
  "http": {
4
  "commandName": "Project",
 
5
  "launchBrowser": true,
6
  "launchUrl": "swagger",
 
7
  "environmentVariables": {
8
  "ASPNETCORE_ENVIRONMENT": "Development"
9
+ },
10
+ "dotnetRunMessages": true,
11
+ "applicationUrl": "http://localhost:7001"
12
  },
13
  "https": {
14
  "commandName": "Project",
 
15
  "launchBrowser": true,
16
  "launchUrl": "swagger",
 
17
  "environmentVariables": {
18
  "ASPNETCORE_ENVIRONMENT": "Development"
19
+ },
20
+ "dotnetRunMessages": true,
21
+ "applicationUrl": "https://localhost:7000;http://localhost:7001"
22
  },
23
+ "Container (Dockerfile)": {
24
+ "commandName": "Docker",
25
+ "launchBrowser": true,
26
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
27
+ "environmentVariables": {
28
+ "ASPNETCORE_HTTPS_PORTS": "8081",
29
+ "ASPNETCORE_HTTP_PORTS": "8080"
30
+ },
31
+ "publishAllPorts": true,
32
+ "useSSL": true
33
+ }
34
+ },
35
+ "$schema": "http://json.schemastore.org/launchsettings.json"
36
+ }
QuotesAPI.csproj CHANGED
@@ -4,12 +4,16 @@
4
  <TargetFramework>net8.0</TargetFramework>
5
  <Nullable>enable</Nullable>
6
  <ImplicitUsings>enable</ImplicitUsings>
 
 
 
7
  </PropertyGroup>
8
 
9
  <ItemGroup>
10
  <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
11
  <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
12
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
 
13
  <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
14
  </ItemGroup>
15
 
 
4
  <TargetFramework>net8.0</TargetFramework>
5
  <Nullable>enable</Nullable>
6
  <ImplicitUsings>enable</ImplicitUsings>
7
+ <UserSecretsId>71dd8124-fff4-447d-8067-30def51d324b</UserSecretsId>
8
+ <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9
+ <DockerfileContext>.</DockerfileContext>
10
  </PropertyGroup>
11
 
12
  <ItemGroup>
13
  <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
14
  <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
15
  <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
16
+ <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
17
  <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
18
  </ItemGroup>
19
 
QuotesAPI.sln ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 12.00
3
+ # Visual Studio Version 17
4
+ VisualStudioVersion = 17.10.35201.131
5
+ MinimumVisualStudioVersion = 10.0.40219.1
6
+ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuotesAPI", "QuotesAPI.csproj", "{8C932DCA-10D3-4E50-8A0F-4DF71BB87F6B}"
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
+ {8C932DCA-10D3-4E50-8A0F-4DF71BB87F6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15
+ {8C932DCA-10D3-4E50-8A0F-4DF71BB87F6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
+ {8C932DCA-10D3-4E50-8A0F-4DF71BB87F6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
+ {8C932DCA-10D3-4E50-8A0F-4DF71BB87F6B}.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 = {4284DFA9-D2C8-47E7-B517-6C75EDC3BBD3}
24
+ EndGlobalSection
25
+ EndGlobal