Skip to content

Commit

Permalink
Added sample files
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatdwarkani committed Nov 25, 2020
1 parent 8eef658 commit 3721f4e
Show file tree
Hide file tree
Showing 38 changed files with 4,139 additions and 0 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
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
bin
obj
packages

src/**/*.js
src/**/*.js.map
src/**/*.css
src/**/css/**/*.css
src/mvc-sample-app/tslint-report/

.vs/
site
publish
*.pubxml
*.user
*.bat
!src/mvc-sample-app/watch.bat
*.txt
!StagingServer.pubxml
!LocalMachine.pubxml
node_modules
!DeleteNodePackages.bat
!InstallNpmModules.bat
tools
!tools/packages.config
TestResult.xml
cireports
lib
dist
StyleCop.Cache
*StyleCopAnalysis.xml
*JSLintAnalysis.html
*TSLintAnalysis.xml
system.cachebuster.json
*SASSLintAnalysis.html
temporaryfiles
.vscode
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-alpine AS base

WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:5.0-buster AS build

#Installing nodejs

RUN apt-get update -yq \
&& apt-get install curl gnupg -yq \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get install nodejs -yq

#Installing gulp

RUN npm install -g gulp

WORKDIR /src

COPY ["src/sample-library-proj/sample-library-proj.csproj.csproj", "src/sample-library-proj/"]
COPY ["src/mvc-sample-app/mvc-sample-app.csproj", "src/mvc-sample-app/"]
COPY ["src/mvc-sample-app/package.json", "src/mvc-sample-app/"]
COPY *.config .

WORKDIR "/src/src/mvc-sample-app"

#Installing npm packages
RUN npm install

WORKDIR /src

RUN dotnet restore "src/mvc-sample-app/mvc-sample-app.csproj" --disable-parallel --configfile ./nuget.config
COPY . .
WORKDIR "/src/src/mvc-sample-app"

#setting release mode for node packages and webpacking
ENV NODE_ENV="Release"
RUN npm install -g webpack
RUN npm install -g webpack-cli
RUN gulp build
RUN dotnet build "mvc-sample-app.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "mvc-sample-app.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app


ENV ApplicationDetails__SecretKey=SecretKeyPassedThroughEnvironmentVariable
ENV AppSettings__EnableHTTPS="false"


COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "mvc-sample-app.dll"]
31 changes: 31 additions & 0 deletions mvc-sample-app.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mvc-sample-app", "src\mvc-sample-app\mvc-sample-app.csproj", "{319D6F84-4670-4E85-B22C-5EF0A8F5733F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "sample-library-proj", "src\sample-library-proj\sample-library-proj.csproj", "{06B7CE72-A773-4F48-AA38-2B80FBEBB985}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{319D6F84-4670-4E85-B22C-5EF0A8F5733F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{319D6F84-4670-4E85-B22C-5EF0A8F5733F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{319D6F84-4670-4E85-B22C-5EF0A8F5733F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{319D6F84-4670-4E85-B22C-5EF0A8F5733F}.Release|Any CPU.Build.0 = Release|Any CPU
{06B7CE72-A773-4F48-AA38-2B80FBEBB985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{06B7CE72-A773-4F48-AA38-2B80FBEBB985}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06B7CE72-A773-4F48-AA38-2B80FBEBB985}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06B7CE72-A773-4F48-AA38-2B80FBEBB985}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B179FE79-A531-494C-BCD4-591680CF2AA8}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
25 changes: 25 additions & 0 deletions src/mvc-sample-app/.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
22 changes: 22 additions & 0 deletions src/mvc-sample-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#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-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["mvc-sample-app.csproj", ""]
RUN dotnet restore "./mvc-sample-app.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "mvc-sample-app.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "mvc-sample-app.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "mvc-sample-app.dll"]
26 changes: 26 additions & 0 deletions src/mvc-sample-app/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
32 changes: 32 additions & 0 deletions src/mvc-sample-app/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

namespace mvc_sample_app.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
11 changes: 11 additions & 0 deletions src/mvc-sample-app/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<button id="button">Click Here</button>
</div>
25 changes: 25 additions & 0 deletions src/mvc-sample-app/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace mvc_sample_app.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;

public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}

public void OnGet()
{

}
}
}
8 changes: 8 additions & 0 deletions src/mvc-sample-app/Pages/Privacy.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>

<p>Use this page to detail your site's privacy policy.</p>
24 changes: 24 additions & 0 deletions src/mvc-sample-app/Pages/Privacy.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace mvc_sample_app.Pages
{
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;

public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}

public void OnGet()
{
}
}
}
Loading

0 comments on commit 3721f4e

Please sign in to comment.