Added docker support

master
Tudor Stanciu 2020-12-25 01:17:36 +02:00
parent ee13545e61
commit 7d8f5e62ac
4 changed files with 62 additions and 1 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

@ -0,0 +1,34 @@
#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/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY dependencies.props .
COPY Directory.Build.props .
COPY ["IdentityServer.Api/IdentityServer.Api.csproj", "IdentityServer.Api/"]
COPY ["IdentityServer.Application/IdentityServer.Application.csproj", "IdentityServer.Application/"]
COPY ["IdentityServer.Domain/IdentityServer.Domain.csproj", "IdentityServer.Domain/"]
COPY ["IdentityServer.PublishedLanguage/IdentityServer.PublishedLanguage.csproj", "IdentityServer.PublishedLanguage/"]
COPY ["IdentityServer.Domain.Data/IdentityServer.Domain.Data.csproj", "IdentityServer.Domain.Data/"]
RUN dotnet restore "IdentityServer.Api/IdentityServer.Api.csproj"
COPY . .
WORKDIR "/src/IdentityServer.Api"
RUN dotnet build "IdentityServer.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "IdentityServer.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV urls="http://*:80"
ENV ConnectionStrings__DatabaseConnection="***REMOVED***"
#Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "IdentityServer.Api.dll"]

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>

View File

@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.Api", "Ident
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0B8B6E9B-0200-47EC-91D9-BEDF4BFC248F}"
ProjectSection(SolutionItems) = preProject
.dockerignore = .dockerignore
.gitattributes = .gitattributes
.gitignore = .gitignore
dependencies.props = dependencies.props
@ -26,7 +27,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.Domain.Data"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.PublishedLanguage", "IdentityServer.PublishedLanguage\IdentityServer.PublishedLanguage.csproj", "{67B4D1FF-D02E-4DA6-9FB8-F71667360448}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServer.Wrapper", "IdentityServer.Wrapper\IdentityServer.Wrapper.csproj", "{F6FEC33B-C79E-4484-B356-9C7F1A5E5D95}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer.Wrapper", "IdentityServer.Wrapper\IdentityServer.Wrapper.csproj", "{F6FEC33B-C79E-4484-B356-9C7F1A5E5D95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution