diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/PARR.DAL/Models/Test.cs b/PARR.DAL/Models/Test.cs deleted file mode 100644 index 84ecbbf6..00000000 --- a/PARR.DAL/Models/Test.cs +++ /dev/null @@ -1,19 +0,0 @@ -using PARR.DAL.Models.Base; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace PARR.DAL.Models -{ - [Table("Tests")] - public class Test : IBase - { - [Key] - public Guid Id { get; set; } - public DateTimeOffset DateCreated { get; set; } - public DateTimeOffset? DateModified { get; set; } - - public required string Name { get; set; } - - public string? Description { get; set; } - } -} diff --git a/PARR_API.sln b/PARR_API.sln index 1da0e13d..cfde93c2 100644 --- a/PARR_API.sln +++ b/PARR_API.sln @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.API", "PARR_API\PARR.API.csproj", "{82C57299-DA04-4A99-9C04-614FDDCE7AA1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.API", "PARR_API\PARR.API.csproj", "{82C57299-DA04-4A99-9C04-614FDDCE7AA1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.DAL", "PARR.DAL\PARR.DAL.csproj", "{CBC557EE-382E-4386-B4D2-2EE3DC9A7CBE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.DAL", "PARR.DAL\PARR.DAL.csproj", "{CBC557EE-382E-4386-B4D2-2EE3DC9A7CBE}" +EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{AF6BD539-34B2-4D57-AEB3-F6FDE26B98ED}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,9 @@ Global {CBC557EE-382E-4386-B4D2-2EE3DC9A7CBE}.Debug|Any CPU.Build.0 = Debug|Any CPU {CBC557EE-382E-4386-B4D2-2EE3DC9A7CBE}.Release|Any CPU.ActiveCfg = Release|Any CPU {CBC557EE-382E-4386-B4D2-2EE3DC9A7CBE}.Release|Any CPU.Build.0 = Release|Any CPU + {AF6BD539-34B2-4D57-AEB3-F6FDE26B98ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF6BD539-34B2-4D57-AEB3-F6FDE26B98ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF6BD539-34B2-4D57-AEB3-F6FDE26B98ED}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PARR_API/Dockerfile b/PARR_API/Dockerfile new file mode 100644 index 00000000..9e5c59f7 --- /dev/null +++ b/PARR_API/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["PARR_API/PARR.API.csproj", "PARR_API/"] +COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"] +RUN dotnet restore "PARR_API/PARR.API.csproj" +COPY . . +WORKDIR "/src/PARR_API" +RUN dotnet build "PARR.API.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "PARR.API.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "PARR.API.dll"] \ No newline at end of file diff --git a/PARR_API/PARR.API.csproj b/PARR_API/PARR.API.csproj index bfee007d..6ec43675 100644 --- a/PARR_API/PARR.API.csproj +++ b/PARR_API/PARR.API.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -23,6 +25,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/PARR_API/Properties/launchSettings.json b/PARR_API/Properties/launchSettings.json index af733197..6fad7ddc 100644 --- a/PARR_API/Properties/launchSettings.json +++ b/PARR_API/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:59274", - "sslPort": 0 - } - }, +{ "profiles": { "http": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5104", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5104" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:59274", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/docker-compose.dcproj b/docker-compose.dcproj new file mode 100644 index 00000000..d451c895 --- /dev/null +++ b/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + af6bd539-34b2-4d57-aeb3-f6fde26b98ed + LaunchBrowser + {Scheme}://localhost:{ServicePort}/swagger + parr.api + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 00000000..3546a8d5 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,8 @@ +#version: '3.4' + +#services: +# parr.api: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# ports: +# - "80" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..f8a19b73 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +#version: '3.4' + +#services: +# parr.api: +# image: ${DOCKER_REGISTRY-}parrapi +# build: +# context: . +# dockerfile: PARR_API/Dockerfile