Skip to content

Commit

Permalink
⛏ Add docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
furkandeveloper committed Aug 5, 2021
1 parent a3440e1 commit e16bc59
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#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:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["samples/IronHook.Web/IronHook.Web.csproj", "samples/IronHook.Web/"]
COPY ["src/IronHook.PostgreSql/IronHook.PostgreSql.csproj", "src/IronHook.PostgreSql/"]
COPY ["src/IronHook.EntityFrameworkCore/IronHook.EntityFrameworkCore.csproj", "src/IronHook.EntityFrameworkCore/"]
COPY ["src/IronHook.Core/IronHook.Core.csproj", "src/IronHook.Core/"]
RUN dotnet restore "samples/IronHook.Web/IronHook.Web.csproj"
COPY . .
WORKDIR "/src/samples/IronHook.Web"
RUN dotnet build "IronHook.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "IronHook.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
CMD ASPNETCORE_URLS=http://*:$PORT dotnet IronHook.Web.dll
4 changes: 4 additions & 0 deletions samples/IronHook.Web/IronHook.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>63f74f68-04e1-4eae-9e39-cf946ac88d11</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -15,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.MarkdownDocumenting" Version="2.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.14" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.8">
<PrivateAssets>all</PrivateAssets>
Expand Down
17 changes: 12 additions & 5 deletions samples/IronHook.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
Expand All @@ -17,12 +17,19 @@
},
"IronHook.Web": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
}

0 comments on commit e16bc59

Please sign in to comment.