add docker support

master
Tudor Stanciu 2023-01-21 16:16:20 +02:00
parent 3a8ddce394
commit d2f61d568c
3 changed files with 60 additions and 0 deletions

25
.dockerignore Normal file
View File

@ -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

View File

@ -2,6 +2,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

33
src/Correo/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
#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:6.0-bullseye-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build
WORKDIR /workspace
COPY ["dependencies.props", "."]
COPY ["directory.build.props", "."]
COPY ["nuget.config", "."]
COPY ["src/Correo/Correo.csproj", "src/Correo/"]
COPY ["src/Correo.Application/Correo.Application.csproj", "src/Correo.Application/"]
COPY ["src/Correo.Abstractions/Correo.Abstractions.csproj", "src/Correo.Abstractions/"]
COPY ["src/Correo.Domain/Correo.Domain.csproj", "src/Correo.Domain/"]
COPY ["src/Correo.PublishedLanguage/Correo.PublishedLanguage.csproj", "src/Correo.PublishedLanguage/"]
COPY ["src/Correo.Mailgun/Correo.Mailgun.csproj", "src/Correo.Mailgun/"]
COPY ["src/Correo.MailKit/Correo.MailKit.csproj", "src/Correo.MailKit/"]
COPY ["src/Correo.NetSmtpClient/Correo.NetSmtpClient.csproj", "src/Correo.NetSmtpClient/"]
COPY ["src/Correo.SendGrid/Correo.SendGrid.csproj", "src/Correo.SendGrid/"]
RUN dotnet restore "src/Correo/Correo.csproj"
COPY . .
WORKDIR "/workspace/src/Correo"
RUN dotnet build "Correo.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Correo.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Correo.dll"]