Merge pull request #28 from dotnet-architecture/dev

upd fork
This commit is contained in:
Taras Kovalenko 2018-06-18 15:33:17 +03:00 committed by GitHub
commit 7b1174a66f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 293 additions and 506 deletions

View File

@ -25,8 +25,8 @@ $env:ESHOP_AZURE_STORAGE_CATALOG_URL ="http://10.0.75.1:5101/api/v1/catalog/item
$env:ESHOP_AZURE_STORAGE_MARKETING_URL ="http://10.0.75.1:5110/api/v1/campaigns/[0]/pic/" $env:ESHOP_AZURE_STORAGE_MARKETING_URL ="http://10.0.75.1:5110/api/v1/campaigns/[0]/pic/"
if (-Not $customEventBusLoginPassword) { if (-Not $customEventBusLoginPassword) {
docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" -f "$rootPath\docker-compose.override.windows.yml" up docker-compose -f "$rootPath\docker-compose.yml" -f "$rootPath\docker-compose.override.yml" -f "$rootPath\docker-compose.windows.yml" -f "$rootPath\docker-compose.override.windows.yml" up
} }
else { else {
docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" up docker-compose -f "$rootPath\docker-compose.yml" -f "$rootPath\docker-compose.override.yml" -f "$rootPath\docker-compose.windows.yml" up
} }

View File

@ -1,138 +0,0 @@
version: '3.4'
services:
basket.api:
image: eshop/basket.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Basket/Basket.API/Dockerfile
depends_on:
- basket.data
- identity.api
- rabbitmq
catalog.api:
image: eshop/catalog.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
identity.api:
image: eshop/identity.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Identity/Identity.API/Dockerfile
depends_on:
- sql.data
ordering.api:
image: eshop/ordering.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.API/Dockerfile
depends_on:
- sql.data
- rabbitmq
ordering.backgroundtasks:
image: eshop/ordering.backgroundtasks-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile
depends_on:
- sql.data
- rabbitmq
ordering.signalrhub:
image: eshop/ordering.signalrhub:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
depends_on:
- sql.data
- identity.api
- rabbitmq
marketing.api:
image: eshop/marketing.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Marketing/Marketing.API/Dockerfile
depends_on:
- sql.data
- nosql.data
- identity.api
- rabbitmq
webspa:
image: eshop/webspa-win:${TAG:-latest}
build:
context: .
dockerfile: src/Web/WebSPA/Dockerfile
depends_on:
- catalog.api
- ordering.api
- identity.api
- basket.api
- marketing.api
webmvc:
image: eshop/webmvc-win:${TAG:-latest}
build:
context: .
dockerfile: src/Web/WebMVC/Dockerfile
depends_on:
- catalog.api
- ordering.api
- identity.api
- basket.api
- marketing.api
webstatus:
image: eshop/webstatus-win:${TAG:-latest}
build:
context: .
dockerfile: src/Web/WebStatus/Dockerfile
payment.api:
image: eshop/payment.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Payment/Payment.API/Dockerfile
depends_on:
- rabbitmq
locations.api:
image: eshop/locations.api-win:${TAG:-latest}
build:
context: .
dockerfile: src/Services/Location/Locations.API/Dockerfile
depends_on:
- nosql.data
- rabbitmq
sql.data:
image: microsoft/mssql-server-windows-developer
nosql.data:
image: mongo:windowsservercore
basket.data:
image: redis:nanoserver
ports:
- "6379:6379"
rabbitmq:
image: spring2/rabbitmq
ports:
- "15672:15672"
- "5672:5672"
networks:
default:
external:
name: nat

View File

@ -37,11 +37,6 @@ services:
- EventBusUserName=admin - EventBusUserName=admin
- EventBusPassword=password - EventBusPassword=password
ordering.api:
environment:
- EventBusUserName=admin
- EventBusPassword=password
ordering.backgroundtasks: ordering.backgroundtasks:
environment: environment:
- EventBusUserName=admin - EventBusUserName=admin

View File

@ -252,8 +252,7 @@ services:
ports: ports:
- "5200:80" - "5200:80"
volumes: volumes:
- ./src/ApiGateways/Mobile.Bff.Shopping/apigw:/app/configuration - ./src/ApiGateways/Mobile.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
mobilemarketingapigw: mobilemarketingapigw:
environment: environment:
- ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_ENVIRONMENT=Development
@ -261,7 +260,7 @@ services:
ports: ports:
- "5201:80" - "5201:80"
volumes: volumes:
- ./src/ApiGateways/Mobile.Bff.Marketing/apigw:/app/configuration - ./src/ApiGateways/Mobile.Bff.Marketing/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
webshoppingapigw: webshoppingapigw:
environment: environment:
@ -270,7 +269,7 @@ services:
ports: ports:
- "5202:80" - "5202:80"
volumes: volumes:
- ./src/ApiGateways/Web.Bff.Shopping/apigw:/app/configuration - ./src/ApiGateways/Web.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
webmarketingapigw: webmarketingapigw:
environment: environment:
@ -279,7 +278,7 @@ services:
ports: ports:
- "5203:80" - "5203:80"
volumes: volumes:
- ./src/ApiGateways/Web.Bff.Marketing/apigw:/app/configuration - ./src/ApiGateways/Web.Bff.Marketing/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
mobileshoppingagg: mobileshoppingagg:
environment: environment:

View File

@ -0,0 +1,39 @@
# This file contains specific services build and images for Windows Containers.
#
# MUST be used alongside "docker-compose.yml" in all windows container commands
version: '3.4'
services:
identity.api:
build:
args:
NODE_IMAGE: stefanscherer/node-windows:8.11
webmvc:
build:
args:
NODE_IMAGE: stefanscherer/node-windows:8.11
webspa:
build:
args:
NODE_IMAGE: stefanscherer/node-windows:8.11
sql.data:
image: microsoft/mssql-server-windows-developer
nosql.data:
image: mongo:windowsservercore
basket.data:
image: redis:nanoserver
rabbitmq:
image: spring2/rabbitmq
networks:
default:
external:
name: nat

View File

@ -202,10 +202,10 @@ services:
build: build:
context: . context: .
dockerfile: src/Web/WebSPA/Dockerfile dockerfile: src/Web/WebSPA/Dockerfile
depends_on: # depends_on:
- webshoppingagg # - webshoppingagg
- webshoppingapigw # - webshoppingapigw
- webmarketingapigw # - webmarketingapigw
webmvc: webmvc:

View File

@ -0,0 +1,8 @@
#!/bin/sh
export NODE_DOWNLOAD_SHA 0e20787e2eda4cc31336d8327556ebc7417e8ee0a6ba0de96a09b0ec2b841f60
curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs

View File

@ -0,0 +1,4 @@
set NODE_VERSION=8.11.1
curl -SL "https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-win-x64.zip" --output nodejs.zip
tar -xf nodejs.zip -C c:\
setx PATH "%PATH%;c:\node-v%NODE_VERSION%-win-x64"

View File

@ -13,14 +13,8 @@ namespace eShopOnContainers.Core.ViewModels
{ {
public class SettingsViewModel : ViewModelBase public class SettingsViewModel : ViewModelBase
{ {
private string _titleUseAzureServices;
private string _descriptionUseAzureServices;
private bool _useAzureServices; private bool _useAzureServices;
private string _titleUseFakeLocation;
private string _descriptionUseFakeLocation;
private bool _allowGpsLocation; private bool _allowGpsLocation;
private string _titleAllowGpsLocation;
private string _descriptionAllowGpsLocation;
private bool _useFakeLocation; private bool _useFakeLocation;
private string _endpoint; private string _endpoint;
private double _latitude; private double _latitude;
@ -48,21 +42,16 @@ namespace eShopOnContainers.Core.ViewModels
public string TitleUseAzureServices public string TitleUseAzureServices
{ {
get => _titleUseAzureServices; get { return !UseAzureServices ? "Use Mock Services" : "Use Microservices/Containers from eShopOnContainers"; }
set
{
_titleUseAzureServices = value;
RaisePropertyChanged(() => TitleUseAzureServices);
}
} }
public string DescriptionUseAzureServices public string DescriptionUseAzureServices
{ {
get => _descriptionUseAzureServices; get
set
{ {
_descriptionUseAzureServices = value; return !UseAzureServices
RaisePropertyChanged(() => DescriptionUseAzureServices); ? "Mock Services are simulated objects that mimic the behavior of real services using a controlled approach."
: "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker containers at the specified base endpoint, which will must be reachable through the network.";
} }
} }
@ -72,30 +61,23 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_useAzureServices = value; _useAzureServices = value;
UpdateUseAzureServices(); UpdateUseAzureServices();
RaisePropertyChanged(() => UseAzureServices); RaisePropertyChanged(() => UseAzureServices);
} }
} }
public string TitleUseFakeLocation public string TitleUseFakeLocation
{ {
get => _titleUseFakeLocation; get { return !UseFakeLocation ? "Use Real Location" : "Use Fake Location"; }
set
{
_titleUseFakeLocation = value;
RaisePropertyChanged(() => TitleUseFakeLocation);
}
} }
public string DescriptionUseFakeLocation public string DescriptionUseFakeLocation
{ {
get => _descriptionUseFakeLocation; get
set
{ {
_descriptionUseFakeLocation = value; return !UseFakeLocation
RaisePropertyChanged(() => DescriptionUseFakeLocation); ? "When enabling location, the app will attempt to use the location from the device."
: "Fake Location data is added for marketing campaign testing.";
} }
} }
@ -105,30 +87,23 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_useFakeLocation = value; _useFakeLocation = value;
UpdateFakeLocation(); UpdateFakeLocation();
RaisePropertyChanged(() => UseFakeLocation); RaisePropertyChanged(() => UseFakeLocation);
} }
} }
public string TitleAllowGpsLocation public string TitleAllowGpsLocation
{ {
get => _titleAllowGpsLocation; get { return !AllowGpsLocation ? "GPS Location Disabled" : "GPS Location Enabled"; }
set
{
_titleAllowGpsLocation = value;
RaisePropertyChanged(() => TitleAllowGpsLocation);
}
} }
public string DescriptionAllowGpsLocation public string DescriptionAllowGpsLocation
{ {
get => _descriptionAllowGpsLocation; get
set
{ {
_descriptionAllowGpsLocation = value; return !AllowGpsLocation
RaisePropertyChanged(() => DescriptionAllowGpsLocation); ? "When disabling location, you won't receive location campaigns based upon your location."
: "When enabling location, you'll receive location campaigns based upon your location.";
} }
} }
@ -148,12 +123,10 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_endpoint = value; _endpoint = value;
if (!string.IsNullOrEmpty(_endpoint)) if (!string.IsNullOrEmpty(_endpoint))
{ {
UpdateEndpoint(); UpdateEndpoint();
} }
RaisePropertyChanged(() => Endpoint); RaisePropertyChanged(() => Endpoint);
} }
} }
@ -164,9 +137,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_latitude = value; _latitude = value;
UpdateLatitude(); UpdateLatitude();
RaisePropertyChanged(() => Latitude); RaisePropertyChanged(() => Latitude);
} }
} }
@ -177,9 +148,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_longitude = value; _longitude = value;
UpdateLongitude(); UpdateLongitude();
RaisePropertyChanged(() => Longitude); RaisePropertyChanged(() => Longitude);
} }
} }
@ -190,9 +159,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_allowGpsLocation = value; _allowGpsLocation = value;
UpdateAllowGpsLocation(); UpdateAllowGpsLocation();
RaisePropertyChanged(() => AllowGpsLocation); RaisePropertyChanged(() => AllowGpsLocation);
} }
} }
@ -207,19 +174,11 @@ namespace eShopOnContainers.Core.ViewModels
public ICommand ToggleAllowGpsLocationCommand => new Command(ToggleAllowGpsLocation); public ICommand ToggleAllowGpsLocationCommand => new Command(ToggleAllowGpsLocation);
public override Task InitializeAsync(object navigationData)
{
UpdateInfoUseAzureServices();
UpdateInfoFakeLocation();
UpdateInfoAllowGpsLocation();
return base.InitializeAsync(navigationData);
}
private async Task ToggleMockServicesAsync() private async Task ToggleMockServicesAsync()
{ {
ViewModelLocator.UpdateDependencies(!UseAzureServices); ViewModelLocator.UpdateDependencies(!UseAzureServices);
UpdateInfoUseAzureServices(); RaisePropertyChanged(() => TitleUseAzureServices);
RaisePropertyChanged(() => DescriptionUseAzureServices);
var previousPageViewModel = NavigationService.PreviousPageViewModel; var previousPageViewModel = NavigationService.PreviousPageViewModel;
if (previousPageViewModel != null) if (previousPageViewModel != null)
@ -243,7 +202,8 @@ namespace eShopOnContainers.Core.ViewModels
private void ToggleFakeLocationAsync() private void ToggleFakeLocationAsync()
{ {
ViewModelLocator.UpdateDependencies(!UseAzureServices); ViewModelLocator.UpdateDependencies(!UseAzureServices);
UpdateInfoFakeLocation(); RaisePropertyChanged(() => TitleUseFakeLocation);
RaisePropertyChanged(() => DescriptionUseFakeLocation);
} }
private async Task ToggleSendLocationAsync() private async Task ToggleSendLocationAsync()
@ -263,51 +223,8 @@ namespace eShopOnContainers.Core.ViewModels
private void ToggleAllowGpsLocation() private void ToggleAllowGpsLocation()
{ {
UpdateInfoAllowGpsLocation(); RaisePropertyChanged(() => TitleAllowGpsLocation);
} RaisePropertyChanged(() => DescriptionAllowGpsLocation);
private void UpdateInfoUseAzureServices()
{
if (!UseAzureServices)
{
TitleUseAzureServices = "Use Mock Services";
DescriptionUseAzureServices = "Mock Services are simulated objects that mimic the behavior of real services using a controlled approach.";
}
else
{
TitleUseAzureServices = "Use Microservices/Containers from eShopOnContainers";
DescriptionUseAzureServices = "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker containers at the specified base endpoint, which will must be reachable through the network.";
}
}
private void UpdateInfoFakeLocation()
{
if (!UseFakeLocation)
{
TitleUseFakeLocation = "Use Real Location";
DescriptionUseFakeLocation = "When enabling location, the app will attempt to use the location from the device.";
}
else
{
TitleUseFakeLocation = "Use Fake Location";
DescriptionUseFakeLocation = "Fake Location data is added for marketing campaign testing.";
}
}
private void UpdateInfoAllowGpsLocation()
{
if (!AllowGpsLocation)
{
TitleAllowGpsLocation = "GPS Location Disabled";
DescriptionAllowGpsLocation = "When disabling location, you won't receive location campaigns based upon your location.";
}
else
{
TitleAllowGpsLocation = "GPS Location Enabled";
DescriptionAllowGpsLocation = "When enabling location, you'll receive location campaigns based upon your location.";
}
} }
private void UpdateUseAzureServices() private void UpdateUseAzureServices()

View File

@ -116,19 +116,14 @@
Animation="{StaticResource MockServicesAnimation}" /> Animation="{StaticResource MockServicesAnimation}" />
</EventTrigger> </EventTrigger>
</ContentPage.Triggers> </ContentPage.Triggers>
<Grid
BackgroundColor="{StaticResource BackgroundColor}">
<!-- SETTINGS --> <!-- SETTINGS -->
<ScrollView> <Grid x:Name="MockServices" BackgroundColor="{StaticResource BackgroundColor}">
<StackLayout
x:Name="MockServices">
<Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="1" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@ -137,8 +132,6 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- MOCK SERVICES --> <!-- MOCK SERVICES -->
<StackLayout <StackLayout
Grid.Column="0"
Grid.Row="1"
Style="{StaticResource SettingsStackLayoutStyle}"> Style="{StaticResource SettingsStackLayoutStyle}">
<Label <Label
Text="{Binding TitleUseAzureServices}" Text="{Binding TitleUseAzureServices}"
@ -150,7 +143,6 @@
<!-- ON / OFF --> <!-- ON / OFF -->
<controls:ToggleButton <controls:ToggleButton
Grid.Column="1" Grid.Column="1"
Grid.Row="1"
Checked="{Binding UseAzureServices, Mode=TwoWay}" Checked="{Binding UseAzureServices, Mode=TwoWay}"
Command="{Binding ToggleMockServicesCommand}" Command="{Binding ToggleMockServicesCommand}"
Style="{StaticResource SettingsToggleButtonStyle}"> Style="{StaticResource SettingsToggleButtonStyle}">
@ -171,8 +163,7 @@
</controls:ToggleButton> </controls:ToggleButton>
<!-- ENDPOINT --> <!-- ENDPOINT -->
<StackLayout <StackLayout
Grid.Row="2" Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Style="{StaticResource SettingsStackLayoutStyle}" Style="{StaticResource SettingsStackLayoutStyle}"
IsVisible="{Binding UseAzureServices}"> IsVisible="{Binding UseAzureServices}">
@ -189,11 +180,9 @@
</Entry.Style> </Entry.Style>
</Entry> </Entry>
</StackLayout> </StackLayout>
<!-- USE LOCATIONS --> <!-- USE LOCATIONS -->
<StackLayout <StackLayout
Grid.Column="0" Grid.Row="2"
Grid.Row="3"
IsVisible="{Binding UserIsLogged}" IsVisible="{Binding UserIsLogged}"
Style="{StaticResource SettingsStackLayoutStyle}"> Style="{StaticResource SettingsStackLayoutStyle}">
<Label <Label
@ -206,7 +195,7 @@
<!-- ON / OFF --> <!-- ON / OFF -->
<controls:ToggleButton <controls:ToggleButton
Grid.Column="1" Grid.Column="1"
Grid.Row="3" Grid.Row="2"
Checked="{Binding UseFakeLocation, Mode=TwoWay}" Checked="{Binding UseFakeLocation, Mode=TwoWay}"
Command="{Binding ToggleFakeLocationCommand}" Command="{Binding ToggleFakeLocationCommand}"
Style="{StaticResource SettingsToggleButtonStyle}" Style="{StaticResource SettingsToggleButtonStyle}"
@ -228,8 +217,7 @@
</controls:ToggleButton> </controls:ToggleButton>
<!-- FAKE LOCATIONS --> <!-- FAKE LOCATIONS -->
<StackLayout <StackLayout
Grid.Row="4" Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Style="{StaticResource SettingsStackLayoutStyle}" Style="{StaticResource SettingsStackLayoutStyle}"
IsVisible="{Binding UseFakeLocation}"> IsVisible="{Binding UseFakeLocation}">
@ -265,13 +253,11 @@
</StackLayout> </StackLayout>
<!-- ALLOW GPS LOCATION --> <!-- ALLOW GPS LOCATION -->
<StackLayout <StackLayout
Grid.Column="0" Grid.Row="4"
Grid.Row="5"
Style="{StaticResource SettingsStackLayoutStyle}" Style="{StaticResource SettingsStackLayoutStyle}"
IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}">
<Label <Label
Text="{Binding TitleAllowGpsLocation}" Text="{Binding TitleAllowGpsLocation}"
Style="{StaticResource SettingsTitleStyle}"/> Style="{StaticResource SettingsTitleStyle}"/>
<Label <Label
Text="{Binding DescriptionAllowGpsLocation}" Text="{Binding DescriptionAllowGpsLocation}"
@ -283,7 +269,7 @@
<!-- ON / OFF --> <!-- ON / OFF -->
<controls:ToggleButton <controls:ToggleButton
Grid.Column="1" Grid.Column="1"
Grid.Row="5" Grid.Row="4"
Checked="{Binding AllowGpsLocation, Mode=TwoWay}" Checked="{Binding AllowGpsLocation, Mode=TwoWay}"
Command="{Binding ToggleAllowGpsLocationCommand}" Command="{Binding ToggleAllowGpsLocationCommand}"
Style="{StaticResource SettingsToggleButtonStyle}" Style="{StaticResource SettingsToggleButtonStyle}"
@ -304,7 +290,4 @@
</controls:ToggleButton.UnCheckedImage> </controls:ToggleButton.UnCheckedImage>
</controls:ToggleButton> </controls:ToggleButton>
</Grid> </Grid>
</StackLayout>
</ScrollView>
</Grid>
</ContentPage> </ContentPage>

View File

@ -1,22 +1,20 @@
ARG NODE_IMAGE=node:8.11
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS sdk-with-node FROM microsoft/dotnet:2.1-sdk as dotnet-build
ENV NODE_VERSION 8.11.1 WORKDIR /src
ENV NODE_DOWNLOAD_SHA 0e20787e2eda4cc31336d8327556ebc7417e8ee0a6ba0de96a09b0ec2b841f60
RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
FROM sdk-with-node AS updated-npm FROM ${NODE_IMAGE} as node-build
RUN npm i -g npm WORKDIR /web
COPY src/Services/Identity/Identity.API .
FROM updated-npm as build
RUN npm install -g bower@1.8.4 RUN npm install -g bower@1.8.4
RUN bower install --allow-root
FROM dotnet-build as build
WORKDIR /src/src/Services/Identity/Identity.API/wwwroot
COPY --from=node-build /web/wwwroot .
WORKDIR /src WORKDIR /src
COPY . . COPY . .
WORKDIR /src/src/Services/Identity/Identity.API WORKDIR /src/src/Services/Identity/Identity.API

View File

@ -27,7 +27,6 @@
</ItemGroup> </ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="bower install --allow-root" />
<Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" /> <Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" />
</Target> </Target>

View File

@ -1,26 +1,24 @@
ARG NODE_IMAGE=node:8.11
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS sdk-with-node FROM microsoft/dotnet:2.1-sdk as dotnet-build
ENV NODE_VERSION 8.11.1 WORKDIR /src
ENV NODE_DOWNLOAD_SHA 0e20787e2eda4cc31336d8327556ebc7417e8ee0a6ba0de96a09b0ec2b841f60
RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
FROM sdk-with-node AS updated-npm FROM ${NODE_IMAGE} as node-build
RUN npm i -g npm WORKDIR /web
COPY src/Web/WebMVC .
FROM updated-npm as build
RUN npm install -g bower@1.8.4 RUN npm install -g bower@1.8.4
RUN bower install --allow-root
FROM dotnet-build as build
WORKDIR /src/src/Web/WebMVC/wwwroot
COPY --from=node-build /web/wwwroot .
WORKDIR /src WORKDIR /src
COPY . . COPY . .
WORKDIR /src/src/Web/WebMVC WORKDIR /src/src/Web/WebMVC
RUN dotnet restore -nowarn:msb3202,nu1503 RUN dotnet restore -nowarn:msb3202,nu1503
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app RUN dotnet publish --no-restore -c Release -o /app

View File

@ -31,7 +31,6 @@
</ItemGroup> </ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="bower install --allow-root" />
<Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" /> <Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" />
</Target> </Target>

View File

@ -1,28 +1,24 @@
ARG NODE_IMAGE=node:8.11
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS sdk-with-node FROM microsoft/dotnet:2.1-sdk as dotnet-build
ENV NODE_VERSION 8.11.1 WORKDIR /src
ENV NODE_DOWNLOAD_SHA 0e20787e2eda4cc31336d8327556ebc7417e8ee0a6ba0de96a09b0ec2b841f60
RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
&& echo "$NODE_DOWNLOAD_SHA nodejs.tar.gz" | sha256sum -c - \
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
&& rm nodejs.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
FROM sdk-with-node AS updated-npm FROM ${NODE_IMAGE} as node-build
RUN npm i -g npm WORKDIR /web
COPY src/Web/WebSPA .
RUN npm install
RUN npm run build:prod
FROM updated-npm as build FROM dotnet-build as publish
WORKDIR /src/src/Web/WebSPA/wwwroot
COPY --from=node-build /web/wwwroot .
WORKDIR /src WORKDIR /src
COPY . . COPY . .
WORKDIR /src/src/Web/WebSPA WORKDIR /src/src/Web/WebSPA
RUN dotnet restore -nowarn:msb3202,nu1503 RUN dotnet publish -c Release -o /app
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app

View File

@ -94,16 +94,6 @@
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup> </ItemGroup>
<!-- workaround for https://github.com/aspnet/websdk/issues/114 -->
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
<Exec Command="npm run build:prod" />
<ItemGroup>
<_GeneratedFiles Include="$(GeneratedItemPatterns)" />
<ContentWithTargetPath Include="@(_GeneratedFiles)" TargetPath="%(Identity)" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
</Target>
<!-- workaround for https://github.com/aspnet/websdk/issues/114 --> <!-- workaround for https://github.com/aspnet/websdk/issues/114 -->
<!-- <!--