Skip to content

Commit 8651c5c

Browse files
committed
Add PL boilerplate
1 parent 7d58cc7 commit 8651c5c

10 files changed

+454
-0
lines changed

Lab5.PL/.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.project
6+
**/.settings
7+
**/.toolstarget
8+
**/.vs
9+
**/.vscode
10+
**/.idea
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

Lab5.PL/.gitignore

+235
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
13+
# Build results
14+
[Dd]ebug/
15+
[Dd]ebugPublic/
16+
[Rr]elease/
17+
[Rr]eleases/
18+
x64/
19+
x86/
20+
build/
21+
bld/
22+
bin/
23+
Bin/
24+
obj/
25+
Obj/
26+
27+
# Visual Studio 2015 cache/options directory
28+
.vs/
29+
/wwwroot/dist/
30+
31+
# MSTest test Results
32+
[Tt]est[Rr]esult*/
33+
[Bb]uild[Ll]og.*
34+
35+
# NUNIT
36+
*.VisualState.xml
37+
TestResult.xml
38+
39+
# Build Results of an ATL Project
40+
[Dd]ebugPS/
41+
[Rr]eleasePS/
42+
dlldata.c
43+
44+
*_i.c
45+
*_p.c
46+
*_i.h
47+
*.ilk
48+
*.meta
49+
*.obj
50+
*.pch
51+
*.pdb
52+
*.pgc
53+
*.pgd
54+
*.rsp
55+
*.sbr
56+
*.tlb
57+
*.tli
58+
*.tlh
59+
*.tmp
60+
*.tmp_proj
61+
*.log
62+
*.vspscc
63+
*.vssscc
64+
.builds
65+
*.pidb
66+
*.svclog
67+
*.scc
68+
69+
# Chutzpah Test files
70+
_Chutzpah*
71+
72+
# Visual C++ cache files
73+
ipch/
74+
*.aps
75+
*.ncb
76+
*.opendb
77+
*.opensdf
78+
*.sdf
79+
*.cachefile
80+
81+
# Visual Studio profiler
82+
*.psess
83+
*.vsp
84+
*.vspx
85+
*.sap
86+
87+
# TFS 2012 Local Workspace
88+
$tf/
89+
90+
# Guidance Automation Toolkit
91+
*.gpState
92+
93+
# ReSharper is a .NET coding add-in
94+
_ReSharper*/
95+
*.[Rr]e[Ss]harper
96+
*.DotSettings.user
97+
98+
# JustCode is a .NET coding add-in
99+
.JustCode
100+
101+
# TeamCity is a build add-in
102+
_TeamCity*
103+
104+
# DotCover is a Code Coverage Tool
105+
*.dotCover
106+
107+
# NCrunch
108+
_NCrunch_*
109+
.*crunch*.local.xml
110+
nCrunchTemp_*
111+
112+
# MightyMoose
113+
*.mm.*
114+
AutoTest.Net/
115+
116+
# Web workbench (sass)
117+
.sass-cache/
118+
119+
# Installshield output folder
120+
[Ee]xpress/
121+
122+
# DocProject is a documentation generator add-in
123+
DocProject/buildhelp/
124+
DocProject/Help/*.HxT
125+
DocProject/Help/*.HxC
126+
DocProject/Help/*.hhc
127+
DocProject/Help/*.hhk
128+
DocProject/Help/*.hhp
129+
DocProject/Help/Html2
130+
DocProject/Help/html
131+
132+
# Click-Once directory
133+
publish/
134+
135+
# Publish Web Output
136+
*.[Pp]ublish.xml
137+
*.azurePubxml
138+
# TODO: Comment the next line if you want to checkin your web deploy settings
139+
# but database connection strings (with potential passwords) will be unencrypted
140+
*.pubxml
141+
*.publishproj
142+
143+
# NuGet Packages
144+
*.nupkg
145+
# The packages folder can be ignored because of Package Restore
146+
**/packages/*
147+
# except build/, which is used as an MSBuild target.
148+
!**/packages/build/
149+
# Uncomment if necessary however generally it will be regenerated when needed
150+
#!**/packages/repositories.config
151+
152+
# Microsoft Azure Build Output
153+
csx/
154+
*.build.csdef
155+
156+
# Microsoft Azure Emulator
157+
ecf/
158+
rcf/
159+
160+
# Microsoft Azure ApplicationInsights config file
161+
ApplicationInsights.config
162+
163+
# Windows Store app package directory
164+
AppPackages/
165+
BundleArtifacts/
166+
167+
# Visual Studio cache files
168+
# files ending in .cache can be ignored
169+
*.[Cc]ache
170+
# but keep track of directories ending in .cache
171+
!*.[Cc]ache/
172+
173+
# Others
174+
ClientBin/
175+
~$*
176+
*~
177+
*.dbmdl
178+
*.dbproj.schemaview
179+
*.pfx
180+
*.publishsettings
181+
orleans.codegen.cs
182+
183+
/node_modules
184+
185+
# RIA/Silverlight projects
186+
Generated_Code/
187+
188+
# Backup & report files from converting an old project file
189+
# to a newer Visual Studio version. Backup files are not needed,
190+
# because we have git ;-)
191+
_UpgradeReport_Files/
192+
Backup*/
193+
UpgradeLog*.XML
194+
UpgradeLog*.htm
195+
196+
# SQL Server files
197+
*.mdf
198+
*.ldf
199+
200+
# Business Intelligence projects
201+
*.rdl.data
202+
*.bim.layout
203+
*.bim_*.settings
204+
205+
# Microsoft Fakes
206+
FakesAssemblies/
207+
208+
# GhostDoc plugin setting file
209+
*.GhostDoc.xml
210+
211+
# Node.js Tools for Visual Studio
212+
.ntvs_analysis.dat
213+
214+
# Visual Studio 6 build log
215+
*.plg
216+
217+
# Visual Studio 6 workspace options file
218+
*.opt
219+
220+
# Visual Studio LightSwitch build output
221+
**/*.HTMLClient/GeneratedArtifacts
222+
**/*.DesktopClient/GeneratedArtifacts
223+
**/*.DesktopClient/ModelManifest.xml
224+
**/*.Server/GeneratedArtifacts
225+
**/*.Server/ModelManifest.xml
226+
_Pvt_Extensions
227+
228+
# Paket dependency manager
229+
.paket/paket.exe
230+
231+
# FAKE - F# Make
232+
.fake/
233+
234+
/ClientApp
235+
/Pages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace Lab5.PL.Controllers;
4+
5+
[ApiController]
6+
[Route("[controller]")]
7+
public class WeatherForecastController : ControllerBase
8+
{
9+
private static readonly string[] Summaries = new[]
10+
{
11+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12+
};
13+
14+
private readonly ILogger<WeatherForecastController> _logger;
15+
16+
public WeatherForecastController(ILogger<WeatherForecastController> logger)
17+
{
18+
_logger = logger;
19+
}
20+
21+
[HttpGet]
22+
public IEnumerable<WeatherForecast> Get()
23+
{
24+
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
25+
{
26+
Date = DateTime.Now.AddDays(index),
27+
TemperatureC = Random.Shared.Next(-20, 55),
28+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
29+
})
30+
.ToArray();
31+
}
32+
}

Lab5.PL/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
2+
WORKDIR /app
3+
EXPOSE 80
4+
EXPOSE 443
5+
6+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
7+
WORKDIR /src
8+
COPY ["Lab5.PL/Lab5.PL.csproj", "Lab5.PL/"]
9+
RUN dotnet restore "Lab5.PL/Lab5.PL.csproj"
10+
COPY . .
11+
WORKDIR "/src/Lab5.PL"
12+
RUN dotnet build "Lab5.PL.csproj" -c Release -o /app/build
13+
14+
FROM build AS publish
15+
RUN dotnet publish "Lab5.PL.csproj" -c Release -o /app/publish
16+
17+
FROM base AS final
18+
WORKDIR /app
19+
COPY --from=publish /app/publish .
20+
ENTRYPOINT ["dotnet", "Lab5.PL.dll"]

Lab5.PL/Lab5.PL.csproj

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
7+
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
8+
<IsPackable>false</IsPackable>
9+
<SpaRoot>ClientApp\</SpaRoot>
10+
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
11+
<SpaProxyServerUrl>https://localhost:44468</SpaProxyServerUrl>
12+
<SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand>
13+
<ImplicitUsings>enable</ImplicitUsings>
14+
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
15+
</PropertyGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="6.0.9" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<!-- Don't publish the SPA source files, but do show them in the project files list -->
23+
<Content Remove="$(SpaRoot)**" />
24+
<None Remove="$(SpaRoot)**" />
25+
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
26+
</ItemGroup>
27+
28+
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
29+
<!-- Ensure Node.js is installed -->
30+
<Exec Command="node --version" ContinueOnError="true">
31+
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
32+
</Exec>
33+
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
34+
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
35+
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
36+
</Target>
37+
38+
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
39+
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
40+
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
41+
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />
42+
43+
<!-- Include the newly-built files in the publish output -->
44+
<ItemGroup>
45+
<DistFiles Include="$(SpaRoot)build\**" />
46+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
47+
<RelativePath>wwwroot\%(RecursiveDir)%(FileName)%(Extension)</RelativePath>
48+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
49+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
50+
</ResolvedFileToPublish>
51+
</ItemGroup>
52+
</Target>
53+
</Project>

0 commit comments

Comments
 (0)