Skip to content

Commit

Permalink
🔨 Add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
furkandeveloper committed Apr 21, 2022
1 parent 780e528 commit 3398377
Show file tree
Hide file tree
Showing 4 changed files with 69 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
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#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 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY common.props ./
COPY ["sample/EasyWeb.Demo/EasyWeb.Demo.csproj", "sample/EasyWeb.Demo/"]
COPY ["src/EasyWeb.AspNetCore.Swagger/EasyWeb.AspNetCore.Swagger.csproj", "src/EasyWeb.AspNetCore.Swagger/"]
COPY ["src/EasyWeb.AspNetCore.ApiStandarts/EasyWeb.AspNetCore.ApiStandarts.csproj", "src/EasyWeb.AspNetCore.ApiStandarts/"]
COPY ["src/EasyWeb.AspNetCore.Filters/EasyWeb.AspNetCore.Filters.csproj", "src/EasyWeb.AspNetCore.Filters/"]
COPY ["src/EasyWeb.AspNetCore/EasyWeb.AspNetCore.csproj", "src/EasyWeb.AspNetCore/"]
COPY ["src/EasyWeb.Core/EasyWeb.Core.csproj", "src/EasyWeb.Core/"]
RUN dotnet restore "sample/EasyWeb.Demo/EasyWeb.Demo.csproj"
COPY . .
WORKDIR "/src/sample/EasyWeb.Demo"
RUN dotnet build "EasyWeb.Demo.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "EasyWeb.Demo.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "EasyWeb.Demo.dll"]
4 changes: 4 additions & 0 deletions sample/EasyWeb.Demo/EasyWeb.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<WarningsAsErrors>NU1605</WarningsAsErrors>
<NoWarn>1701;1702;1591;SA1503</NoWarn>
<UserSecretsId>baed6d2a-9999-44d6-be74-e544f28e1025</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
Expand All @@ -19,6 +22,7 @@

<ItemGroup>
<PackageReference Include="AspNetCore.MarkdownDocumenting" Version="2.3.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 12 additions & 5 deletions sample/EasyWeb.Demo/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
Expand All @@ -10,19 +10,26 @@
"profiles": {
"EasyWeb.Demo": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7144;http://localhost:5144",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "https://localhost:7144;http://localhost:5144",
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
"useSSL": true
}
}
}
}

0 comments on commit 3398377

Please sign in to comment.