Skip to content

Commit

Permalink
feat: add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizfriso committed Dec 3, 2023
1 parent 8245c58 commit cfd8bed
Show file tree
Hide file tree
Showing 15 changed files with 408 additions and 223 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.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
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
27 changes: 27 additions & 0 deletions Librarian.WebAPI/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Librarian.WebAPI/Librarian.WebAPI.csproj", "Librarian.WebAPI/"]
COPY ["LibrarianApplication/Librarian.Application.csproj", "LibrarianApplication/"]
COPY ["Librarian.Infra/Librarian.Infrastructure.csproj", "Librarian.Infra/"]
COPY ["LibrarianDomain/Librarian.Domain.csproj", "LibrarianDomain/"]
RUN dotnet restore "./Librarian.WebAPI/./Librarian.WebAPI.csproj"
COPY . .
WORKDIR "/src/Librarian.WebAPI"
RUN dotnet build "./Librarian.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Librarian.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Librarian.WebAPI.dll"]
3 changes: 3 additions & 0 deletions Librarian.WebAPI/Librarian.WebAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<UserSecretsId>70404c10-afd5-44ca-8759-dd081cc92342</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,6 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-preview.2.23128.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Npgsql" Version="7.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down
38 changes: 24 additions & 14 deletions Librarian.WebAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7351",
"sslPort": 44371
}
},
{
"profiles": {
"Librarian.WebAPI": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7281;http://localhost:5180",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7281;http://localhost:5180"
},
"IIS Express": {
"commandName": "IISExpress",
Expand All @@ -26,6 +17,25 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_URLS": "https://+:443;http://+:80"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:7351",
"sslPort": 44371
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand All @@ -10,13 +11,14 @@
using System;
using System.Reflection;

[assembly: Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute("70404c10-afd5-44ca-8759-dd081cc92342")]
[assembly: System.Reflection.AssemblyCompanyAttribute("Librarian.WebAPI")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c5804014009b46945213be298d83eaa73d9c")]
[assembly: System.Reflection.AssemblyProductAttribute("Librarian.WebAPI")]
[assembly: System.Reflection.AssemblyTitleAttribute("Librarian.WebAPI")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Gerado pela classe WriteCodeFragment do MSBuild.
// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
8a736ee4cb26cbcfabc6000a3a6729be825497a7
3860d46c9e348bc68084b20c009bc2c2f218060543c6a604be6639bffc80f79d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Librarian.WebAPI
build_property.RootNamespace = Librarian.WebAPI
build_property.ProjectDir = C:\Projetos\Librarian\Librarian.WebAPI\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 6.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
Expand Down
Binary file modified Librarian.WebAPI/obj/Debug/net6.0/Librarian.WebAPI.assets.cache
Binary file not shown.
Binary file not shown.
56 changes: 28 additions & 28 deletions Librarian.WebAPI/obj/Librarian.WebAPI.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@
"projectUniqueName": "C:\\Projetos\\Librarian\\Librarian.Infra\\Librarian.Infrastructure.csproj",
"projectName": "Librarian.Infrastructure",
"projectPath": "C:\\Projetos\\Librarian\\Librarian.Infra\\Librarian.Infrastructure.csproj",
"packagesPath": "C:\\Users\\beatrizp\\.nuget\\packages\\",
"packagesPath": "C:\\Users\\beatriz.f.de.paula\\.nuget\\packages\\",
"outputPath": "C:\\Projetos\\Librarian\\Librarian.Infra\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\beatrizp\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\beatriz.f.de.paula\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\nuget-local": {},
"https://api.nuget.org/v3/index.json": {},
"https://nuget.miisy.me/index.json": {}
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
Expand Down Expand Up @@ -142,7 +141,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
}
}
},
Expand All @@ -152,24 +151,23 @@
"projectUniqueName": "C:\\Projetos\\Librarian\\Librarian.WebAPI\\Librarian.WebAPI.csproj",
"projectName": "Librarian.WebAPI",
"projectPath": "C:\\Projetos\\Librarian\\Librarian.WebAPI\\Librarian.WebAPI.csproj",
"packagesPath": "C:\\Users\\beatrizp\\.nuget\\packages\\",
"packagesPath": "C:\\Users\\beatriz.f.de.paula\\.nuget\\packages\\",
"outputPath": "C:\\Projetos\\Librarian\\Librarian.WebAPI\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\beatrizp\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\beatriz.f.de.paula\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\nuget-local": {},
"https://api.nuget.org/v3/index.json": {},
"https://nuget.miisy.me/index.json": {}
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
Expand Down Expand Up @@ -239,6 +237,10 @@
"target": "Package",
"version": "[8.0.0-preview.2.23128.3, )"
},
"Microsoft.VisualStudio.Azure.Containers.Tools.Targets": {
"target": "Package",
"version": "[1.19.5, )"
},
"Npgsql": {
"target": "Package",
"version": "[7.0.2, )"
Expand Down Expand Up @@ -287,7 +289,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
}
}
},
Expand All @@ -297,24 +299,23 @@
"projectUniqueName": "C:\\Projetos\\Librarian\\LibrarianApplication\\Librarian.Application.csproj",
"projectName": "Librarian.Application",
"projectPath": "C:\\Projetos\\Librarian\\LibrarianApplication\\Librarian.Application.csproj",
"packagesPath": "C:\\Users\\beatrizp\\.nuget\\packages\\",
"packagesPath": "C:\\Users\\beatriz.f.de.paula\\.nuget\\packages\\",
"outputPath": "C:\\Projetos\\Librarian\\LibrarianApplication\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\beatrizp\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\beatriz.f.de.paula\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\nuget-local": {},
"https://api.nuget.org/v3/index.json": {},
"https://nuget.miisy.me/index.json": {}
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
Expand Down Expand Up @@ -432,7 +433,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
}
}
},
Expand All @@ -442,24 +443,23 @@
"projectUniqueName": "C:\\Projetos\\Librarian\\LibrarianDomain\\Librarian.Domain.csproj",
"projectName": "Librarian.Domain",
"projectPath": "C:\\Projetos\\Librarian\\LibrarianDomain\\Librarian.Domain.csproj",
"packagesPath": "C:\\Users\\beatrizp\\.nuget\\packages\\",
"packagesPath": "C:\\Users\\beatriz.f.de.paula\\.nuget\\packages\\",
"outputPath": "C:\\Projetos\\Librarian\\LibrarianDomain\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\beatrizp\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\beatriz.f.de.paula\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\nuget-local": {},
"https://api.nuget.org/v3/index.json": {},
"https://nuget.miisy.me/index.json": {}
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
Expand Down Expand Up @@ -566,7 +566,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions Librarian.WebAPI/obj/Librarian.WebAPI.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\beatrizp\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.5.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\beatrizp\.nuget\packages\" />
<SourceRoot Include="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\" />
<SourceRoot Include="C:\Users\beatriz.f.de.paula\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)xunit.core\2.4.2\build\xunit.core.props" Condition="Exists('$(NuGetPackageRoot)xunit.core\2.4.2\build\xunit.core.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.apidescription.server\6.0.5\build\Microsoft.Extensions.ApiDescription.Server.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.apidescription.server\6.0.5\build\Microsoft.Extensions.ApiDescription.Server.props')" />
<Import Project="$(NuGetPackageRoot)swashbuckle.aspnetcore\6.5.0\build\Swashbuckle.AspNetCore.props" Condition="Exists('$(NuGetPackageRoot)swashbuckle.aspnetcore\6.5.0\build\Swashbuckle.AspNetCore.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.0-preview.2.23128.3\buildTransitive\net6.0\Microsoft.EntityFrameworkCore.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.0-preview.2.23128.3\buildTransitive\net6.0\Microsoft.EntityFrameworkCore.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.visualstudio.azure.containers.tools.targets\1.19.5\build\Microsoft.VisualStudio.Azure.Containers.Tools.Targets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.visualstudio.azure.containers.tools.targets\1.19.5\build\Microsoft.VisualStudio.Azure.Containers.Tools.Targets.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.0-preview.2.23128.3\build\net6.0\Microsoft.EntityFrameworkCore.Design.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.0-preview.2.23128.3\build\net6.0\Microsoft.EntityFrameworkCore.Design.props')" />
<Import Project="$(NuGetPackageRoot)entityframework\6.4.4\buildTransitive\netcoreapp3.0\EntityFramework.props" Condition="Exists('$(NuGetPackageRoot)entityframework\6.4.4\buildTransitive\netcoreapp3.0\EntityFramework.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Pkgxunit_analyzers Condition=" '$(Pkgxunit_analyzers)' == '' ">C:\Users\beatrizp\.nuget\packages\xunit.analyzers\1.0.0</Pkgxunit_analyzers>
<PkgMicrosoft_Extensions_ApiDescription_Server Condition=" '$(PkgMicrosoft_Extensions_ApiDescription_Server)' == '' ">C:\Users\beatrizp\.nuget\packages\microsoft.extensions.apidescription.server\6.0.5</PkgMicrosoft_Extensions_ApiDescription_Server>
<PkgMicrosoft_EntityFrameworkCore_Tools Condition=" '$(PkgMicrosoft_EntityFrameworkCore_Tools)' == '' ">C:\Users\beatrizp\.nuget\packages\microsoft.entityframeworkcore.tools\8.0.0-preview.2.23128.3</PkgMicrosoft_EntityFrameworkCore_Tools>
<PkgEntityFramework Condition=" '$(PkgEntityFramework)' == '' ">C:\Users\beatrizp\.nuget\packages\entityframework\6.4.4</PkgEntityFramework>
<Pkgxunit_analyzers Condition=" '$(Pkgxunit_analyzers)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\xunit.analyzers\1.0.0</Pkgxunit_analyzers>
<PkgMicrosoft_Extensions_ApiDescription_Server Condition=" '$(PkgMicrosoft_Extensions_ApiDescription_Server)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\microsoft.extensions.apidescription.server\6.0.5</PkgMicrosoft_Extensions_ApiDescription_Server>
<PkgMicrosoft_VisualStudio_Azure_Containers_Tools_Targets Condition=" '$(PkgMicrosoft_VisualStudio_Azure_Containers_Tools_Targets)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.19.5</PkgMicrosoft_VisualStudio_Azure_Containers_Tools_Targets>
<PkgMicrosoft_EntityFrameworkCore_Tools Condition=" '$(PkgMicrosoft_EntityFrameworkCore_Tools)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\microsoft.entityframeworkcore.tools\8.0.0-preview.2.23128.3</PkgMicrosoft_EntityFrameworkCore_Tools>
<PkgEntityFramework Condition=" '$(PkgEntityFramework)' == '' ">C:\Users\beatriz.f.de.paula\.nuget\packages\entityframework\6.4.4</PkgEntityFramework>
</PropertyGroup>
</Project>
Loading

0 comments on commit cfd8bed

Please sign in to comment.