diff options
author | Tom Deseyn <tom.deseyn@gmail.com> | 2022-07-08 14:16:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 14:16:08 +0300 |
commit | a20ae680a7d009a1441dc63b64f0c936af81090e (patch) | |
tree | 76a13546af35dc4eb2f3638203d3a0ad3d03f9b8 | |
parent | 20e61d368fa2f930d6b4f7347b4e5618cc81fa58 (diff) |
Improve multi-stage image build support. (#58)
* Improve multi-stage image build support
-rw-r--r-- | src/Angular-CSharp.csproj.in | 11 | ||||
-rw-r--r-- | src/React-CSharp.csproj.in | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/Angular-CSharp.csproj.in b/src/Angular-CSharp.csproj.in index 3026e53..8d8c646 100644 --- a/src/Angular-CSharp.csproj.in +++ b/src/Angular-CSharp.csproj.in @@ -7,9 +7,11 @@ <NoDefaultLaunchSettingsFile Condition="'$(ExcludeLaunchSettings)' == 'True'">True</NoDefaultLaunchSettingsFile> <!--#if (!NoSpaFrontEnd) --> <SpaRoot>ClientApp\</SpaRoot> + <SpaInstallCommand>npm install</SpaInstallCommand> + <SpaBuildCommand>npm run build</SpaBuildCommand> + <SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand> <SpaProxyServerUrl Condition="'$(RequiresHttps)' == 'True'">https://localhost:5002</SpaProxyServerUrl> <SpaProxyServerUrl Condition="'$(RequiresHttps)' != 'True'">http://localhost:5002</SpaProxyServerUrl> - <SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand> <!--#endif --> <RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.WebApplication1</RootNamespace> <ImplicitUsings>enable</ImplicitUsings> @@ -46,14 +48,15 @@ </Exec> <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." /> <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." /> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaInstallCommand)" /> </Target> <!--/+:cnd:noEmit --> <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish"> <!-- As part of publishing, ensure the JS resources are freshly built in production mode --> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --configuration production" /> + <SkipSpaBuild Condition="'$(DOTNET_RUNNING_IN_CONTAINER)' == 'true'">True</SkipSpaBuild> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaInstallCommand)" Condition="'$(SkipSpaBuild)' != 'True'" /> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaBuildCommand)" Condition="'$(SkipSpaBuild)' != 'True'" /> <!-- Include the newly-built files in the publish output --> <ItemGroup> diff --git a/src/React-CSharp.csproj.in b/src/React-CSharp.csproj.in index 04554a0..7510d29 100644 --- a/src/React-CSharp.csproj.in +++ b/src/React-CSharp.csproj.in @@ -9,10 +9,12 @@ <NoDefaultLaunchSettingsFile Condition="'$(ExcludeLaunchSettings)' == 'True'">True</NoDefaultLaunchSettingsFile> <!--#if (!NoSpaFrontEnd) --> <SpaRoot>ClientApp\</SpaRoot> + <SpaInstallCommand>npm install</SpaInstallCommand> + <SpaBuildCommand>npm run build</SpaBuildCommand> + <SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand> <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes> <SpaProxyServerUrl Condition="'$(RequiresHttps)' == 'True'">https://localhost:5002</SpaProxyServerUrl> <SpaProxyServerUrl Condition="'$(RequiresHttps)' != 'True'">http://localhost:5002</SpaProxyServerUrl> - <SpaProxyLaunchCommand>npm start</SpaProxyLaunchCommand> <!--#endif --> <RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Company.WebApplication1</RootNamespace> <ImplicitUsings>enable</ImplicitUsings> @@ -49,14 +51,15 @@ </Exec> <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." /> <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." /> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaInstallCommand)" /> </Target> <!--/+:cnd:noEmit --> <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish"> <!-- As part of publishing, ensure the JS resources are freshly built in production mode --> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" /> - <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" /> + <SkipSpaBuild Condition="'$(DOTNET_RUNNING_IN_CONTAINER)' == 'true'">True</SkipSpaBuild> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaInstallCommand)" Condition="'$(SkipSpaBuild)' != 'True'" /> + <Exec WorkingDirectory="$(SpaRoot)" Command="$(SpaBuildCommand)" Condition="'$(SkipSpaBuild)' != 'True'" /> <!-- Include the newly-built files in the publish output --> <ItemGroup> |