diff --git a/cli-windows/start-windows-containers.ps1 b/cli-windows/start-windows-containers.ps1 index 85a182603..e89a89066 100644 --- a/cli-windows/start-windows-containers.ps1 +++ b/cli-windows/start-windows-containers.ps1 @@ -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/" 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 { - 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 } diff --git a/docker-compose-windows.yml b/docker-compose-windows.yml deleted file mode 100644 index cdcd6f56b..000000000 --- a/docker-compose-windows.yml +++ /dev/null @@ -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 - diff --git a/docker-compose.override.windows.yml b/docker-compose.override.windows.yml index 0d31493e6..dcaac7c45 100644 --- a/docker-compose.override.windows.yml +++ b/docker-compose.override.windows.yml @@ -37,11 +37,6 @@ services: - EventBusUserName=admin - EventBusPassword=password - ordering.api: - environment: - - EventBusUserName=admin - - EventBusPassword=password - ordering.backgroundtasks: environment: - EventBusUserName=admin @@ -58,6 +53,6 @@ services: - EventBusPassword=password ordering.signalrhub: - environment: + environment: - EventBusUserName=admin - - EventBusPassword=password \ No newline at end of file + - EventBusPassword=password diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 98ad11c62..dcdaff236 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -252,8 +252,7 @@ services: ports: - "5200:80" volumes: - - ./src/ApiGateways/Mobile.Bff.Shopping/apigw:/app/configuration - + - ./src/ApiGateways/Mobile.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration} mobilemarketingapigw: environment: - ASPNETCORE_ENVIRONMENT=Development @@ -261,7 +260,7 @@ services: ports: - "5201:80" volumes: - - ./src/ApiGateways/Mobile.Bff.Marketing/apigw:/app/configuration + - ./src/ApiGateways/Mobile.Bff.Marketing/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration} webshoppingapigw: environment: @@ -270,7 +269,7 @@ services: ports: - "5202:80" volumes: - - ./src/ApiGateways/Web.Bff.Shopping/apigw:/app/configuration + - ./src/ApiGateways/Web.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration} webmarketingapigw: environment: @@ -279,7 +278,7 @@ services: ports: - "5203:80" volumes: - - ./src/ApiGateways/Web.Bff.Marketing/apigw:/app/configuration + - ./src/ApiGateways/Web.Bff.Marketing/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration} mobileshoppingagg: environment: diff --git a/docker-compose.windows.yml b/docker-compose.windows.yml new file mode 100644 index 000000000..4b2eb1a9b --- /dev/null +++ b/docker-compose.windows.yml @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 67879bcd7..097643a3c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -202,10 +202,10 @@ services: build: context: . dockerfile: src/Web/WebSPA/Dockerfile - depends_on: - - webshoppingagg - - webshoppingapigw - - webmarketingapigw +# depends_on: +# - webshoppingagg +# - webshoppingapigw +# - webmarketingapigw webmvc: diff --git a/docker-scripts/linux/install-node.sh b/docker-scripts/linux/install-node.sh new file mode 100644 index 000000000..73407aae9 --- /dev/null +++ b/docker-scripts/linux/install-node.sh @@ -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 diff --git a/docker-scripts/win/install-node.cmd b/docker-scripts/win/install-node.cmd new file mode 100644 index 000000000..eaa4e356c --- /dev/null +++ b/docker-scripts/win/install-node.cmd @@ -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" \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs index 1969880cd..9ee3d5103 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs @@ -13,14 +13,8 @@ namespace eShopOnContainers.Core.ViewModels { public class SettingsViewModel : ViewModelBase { - private string _titleUseAzureServices; - private string _descriptionUseAzureServices; private bool _useAzureServices; - private string _titleUseFakeLocation; - private string _descriptionUseFakeLocation; private bool _allowGpsLocation; - private string _titleAllowGpsLocation; - private string _descriptionAllowGpsLocation; private bool _useFakeLocation; private string _endpoint; private double _latitude; @@ -48,21 +42,16 @@ namespace eShopOnContainers.Core.ViewModels public string TitleUseAzureServices { - get => _titleUseAzureServices; - set - { - _titleUseAzureServices = value; - RaisePropertyChanged(() => TitleUseAzureServices); - } + get { return !UseAzureServices ? "Use Mock Services" : "Use Microservices/Containers from eShopOnContainers"; } } public string DescriptionUseAzureServices { - get => _descriptionUseAzureServices; - set + get { - _descriptionUseAzureServices = value; - RaisePropertyChanged(() => DescriptionUseAzureServices); + return !UseAzureServices + ? "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 { _useAzureServices = value; - UpdateUseAzureServices(); - RaisePropertyChanged(() => UseAzureServices); } } public string TitleUseFakeLocation { - get => _titleUseFakeLocation; - set - { - _titleUseFakeLocation = value; - RaisePropertyChanged(() => TitleUseFakeLocation); - } + get { return !UseFakeLocation ? "Use Real Location" : "Use Fake Location"; } } public string DescriptionUseFakeLocation { - get => _descriptionUseFakeLocation; - set + get { - _descriptionUseFakeLocation = value; - RaisePropertyChanged(() => DescriptionUseFakeLocation); + return !UseFakeLocation + ? "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 { _useFakeLocation = value; - UpdateFakeLocation(); - RaisePropertyChanged(() => UseFakeLocation); } } public string TitleAllowGpsLocation { - get => _titleAllowGpsLocation; - set - { - _titleAllowGpsLocation = value; - RaisePropertyChanged(() => TitleAllowGpsLocation); - } + get { return !AllowGpsLocation ? "GPS Location Disabled" : "GPS Location Enabled"; } } public string DescriptionAllowGpsLocation { - get => _descriptionAllowGpsLocation; - set + get { - _descriptionAllowGpsLocation = value; - RaisePropertyChanged(() => DescriptionAllowGpsLocation); + return !AllowGpsLocation + ? "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 { _endpoint = value; - if (!string.IsNullOrEmpty(_endpoint)) { UpdateEndpoint(); } - RaisePropertyChanged(() => Endpoint); } } @@ -164,9 +137,7 @@ namespace eShopOnContainers.Core.ViewModels set { _latitude = value; - UpdateLatitude(); - RaisePropertyChanged(() => Latitude); } } @@ -177,9 +148,7 @@ namespace eShopOnContainers.Core.ViewModels set { _longitude = value; - UpdateLongitude(); - RaisePropertyChanged(() => Longitude); } } @@ -190,9 +159,7 @@ namespace eShopOnContainers.Core.ViewModels set { _allowGpsLocation = value; - UpdateAllowGpsLocation(); - RaisePropertyChanged(() => AllowGpsLocation); } } @@ -207,19 +174,11 @@ namespace eShopOnContainers.Core.ViewModels public ICommand ToggleAllowGpsLocationCommand => new Command(ToggleAllowGpsLocation); - public override Task InitializeAsync(object navigationData) - { - UpdateInfoUseAzureServices(); - UpdateInfoFakeLocation(); - UpdateInfoAllowGpsLocation(); - - return base.InitializeAsync(navigationData); - } - private async Task ToggleMockServicesAsync() { ViewModelLocator.UpdateDependencies(!UseAzureServices); - UpdateInfoUseAzureServices(); + RaisePropertyChanged(() => TitleUseAzureServices); + RaisePropertyChanged(() => DescriptionUseAzureServices); var previousPageViewModel = NavigationService.PreviousPageViewModel; if (previousPageViewModel != null) @@ -243,7 +202,8 @@ namespace eShopOnContainers.Core.ViewModels private void ToggleFakeLocationAsync() { ViewModelLocator.UpdateDependencies(!UseAzureServices); - UpdateInfoFakeLocation(); + RaisePropertyChanged(() => TitleUseFakeLocation); + RaisePropertyChanged(() => DescriptionUseFakeLocation); } private async Task ToggleSendLocationAsync() @@ -263,53 +223,10 @@ namespace eShopOnContainers.Core.ViewModels 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() { // Save use mocks services to local storage diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml index 968b6321b..7d200bbc8 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml @@ -2,12 +2,12 @@ <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="eShopOnContainers.Core.Views.SettingsView" - xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core" + xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core" xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core" xmlns:converters="clr-namespace:eShopOnContainers.Core.Converters;assembly=eShopOnContainers.Core" xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core" xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core" - viewModelBase:ViewModelLocator.AutoWireViewModel="true" + viewModelBase:ViewModelLocator.AutoWireViewModel="true" Title="Settings"> <ContentPage.Resources> <ResourceDictionary> @@ -92,7 +92,7 @@ <Setter Property="Margin" Value="12,0" /> </Style> - + <animations:StoryBoard x:Key="MockServicesAnimation" Target="{x:Reference MockServices}"> @@ -116,195 +116,178 @@ Animation="{StaticResource MockServicesAnimation}" /> </EventTrigger> </ContentPage.Triggers> - <Grid - BackgroundColor="{StaticResource BackgroundColor}"> - <!-- SETTINGS --> - <ScrollView> - <StackLayout - x:Name="MockServices"> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="Auto" /> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition Height="1" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - <!-- MOCK SERVICES --> - <StackLayout - Grid.Column="0" - Grid.Row="1" - Style="{StaticResource SettingsStackLayoutStyle}"> - <Label - Text="{Binding TitleUseAzureServices}" - Style="{StaticResource SettingsTitleStyle}"/> - <Label - Text="{Binding DescriptionUseAzureServices}" - Style="{StaticResource SettingsDescriptionStyle}"/> - </StackLayout> - <!-- ON / OFF --> - <controls:ToggleButton - Grid.Column="1" - Grid.Row="1" - Checked="{Binding UseAzureServices, Mode=TwoWay}" - Command="{Binding ToggleMockServicesCommand}" - Style="{StaticResource SettingsToggleButtonStyle}"> - <controls:ToggleButton.CheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOn.png" /> - <On Platform="Android" Value="switch_on.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> - </OnPlatform> - </controls:ToggleButton.CheckedImage> - <controls:ToggleButton.UnCheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOff.png" /> - <On Platform="Android" Value="switch_off.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> - </OnPlatform> - </controls:ToggleButton.UnCheckedImage> - </controls:ToggleButton> - <!-- ENDPOINT --> - <StackLayout - Grid.Row="2" - Grid.Column="0" - Grid.ColumnSpan="2" - Style="{StaticResource SettingsStackLayoutStyle}" - IsVisible="{Binding UseAzureServices}"> - <Label - Text="Endpoint" - Style="{StaticResource HeaderLabelStyle}"/> - <Entry - Text="{Binding Endpoint, Mode=TwoWay}"> - <Entry.Style> - <OnPlatform x:TypeArguments="Style"> - <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> - <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> - </OnPlatform> - </Entry.Style> - </Entry> - </StackLayout> - <!-- USE LOCATIONS --> - <StackLayout - Grid.Column="0" - Grid.Row="3" - IsVisible="{Binding UserIsLogged}" - Style="{StaticResource SettingsStackLayoutStyle}"> - <Label - Text="{Binding TitleUseFakeLocation}" - Style="{StaticResource SettingsTitleStyle}"/> - <Label - Text="{Binding DescriptionUseFakeLocation}" - Style="{StaticResource SettingsDescriptionStyle}"/> - </StackLayout> - <!-- ON / OFF --> - <controls:ToggleButton - Grid.Column="1" - Grid.Row="3" - Checked="{Binding UseFakeLocation, Mode=TwoWay}" - Command="{Binding ToggleFakeLocationCommand}" - Style="{StaticResource SettingsToggleButtonStyle}" - IsVisible="{Binding UserIsLogged}"> - <controls:ToggleButton.CheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOn.png" /> - <On Platform="Android" Value="switch_on.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> - </OnPlatform> - </controls:ToggleButton.CheckedImage> - <controls:ToggleButton.UnCheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOff.png" /> - <On Platform="Android" Value="switch_off.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> - </OnPlatform> - </controls:ToggleButton.UnCheckedImage> - </controls:ToggleButton> - <!-- FAKE LOCATIONS --> - <StackLayout - Grid.Row="4" - Grid.Column="0" - Grid.ColumnSpan="2" - Style="{StaticResource SettingsStackLayoutStyle}" - IsVisible="{Binding UseFakeLocation}"> - <Label - Text="Latitude" - Style="{StaticResource HeaderLabelStyle}"/> - <Entry - Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" - Keyboard="Text"> - <Entry.Style> - <OnPlatform x:TypeArguments="Style"> - <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> - <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> - </OnPlatform> - </Entry.Style> - </Entry> - <Label - Text="Longitude" - Style="{StaticResource HeaderLabelStyle}"/> - <Entry - Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" - Keyboard="Text"> - <Entry.Style> - <OnPlatform x:TypeArguments="Style"> - <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> - <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> - </OnPlatform> - </Entry.Style> - </Entry> - <Button - Command="{Binding ToggleSendLocationCommand}" - Text="Send Location"/> - </StackLayout> - <!-- ALLOW GPS LOCATION --> - <StackLayout - Grid.Column="0" - Grid.Row="5" - Style="{StaticResource SettingsStackLayoutStyle}" - IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> - <Label - Text="{Binding TitleAllowGpsLocation}" - - Style="{StaticResource SettingsTitleStyle}"/> - <Label - Text="{Binding DescriptionAllowGpsLocation}" - Style="{StaticResource SettingsDescriptionStyle}"/> - <Label - Text="{Binding GpsWarningMessage}" - Style="{StaticResource SettingsWarningMessageStyle}"/> - </StackLayout> - <!-- ON / OFF --> - <controls:ToggleButton - Grid.Column="1" - Grid.Row="5" - Checked="{Binding AllowGpsLocation, Mode=TwoWay}" - Command="{Binding ToggleAllowGpsLocationCommand}" - Style="{StaticResource SettingsToggleButtonStyle}" - IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> - <controls:ToggleButton.CheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOn.png" /> - <On Platform="Android" Value="switch_on.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> - </OnPlatform> - </controls:ToggleButton.CheckedImage> - <controls:ToggleButton.UnCheckedImage> - <OnPlatform x:TypeArguments="ImageSource"> - <On Platform="iOS" Value="switchOff.png" /> - <On Platform="Android" Value="switch_off.png" /> - <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> - </OnPlatform> - </controls:ToggleButton.UnCheckedImage> - </controls:ToggleButton> - </Grid> - </StackLayout> - </ScrollView> + <!-- SETTINGS --> + <Grid x:Name="MockServices" BackgroundColor="{StaticResource BackgroundColor}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <!-- MOCK SERVICES --> + <StackLayout + Style="{StaticResource SettingsStackLayoutStyle}"> + <Label + Text="{Binding TitleUseAzureServices}" + Style="{StaticResource SettingsTitleStyle}"/> + <Label + Text="{Binding DescriptionUseAzureServices}" + Style="{StaticResource SettingsDescriptionStyle}"/> + </StackLayout> + <!-- ON / OFF --> + <controls:ToggleButton + Grid.Column="1" + Checked="{Binding UseAzureServices, Mode=TwoWay}" + Command="{Binding ToggleMockServicesCommand}" + Style="{StaticResource SettingsToggleButtonStyle}"> + <controls:ToggleButton.CheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOn.png" /> + <On Platform="Android" Value="switch_on.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> + </OnPlatform> + </controls:ToggleButton.CheckedImage> + <controls:ToggleButton.UnCheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOff.png" /> + <On Platform="Android" Value="switch_off.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> + </OnPlatform> + </controls:ToggleButton.UnCheckedImage> + </controls:ToggleButton> + <!-- ENDPOINT --> + <StackLayout + Grid.Row="1" + Grid.ColumnSpan="2" + Style="{StaticResource SettingsStackLayoutStyle}" + IsVisible="{Binding UseAzureServices}"> + <Label + Text="Endpoint" + Style="{StaticResource HeaderLabelStyle}"/> + <Entry + Text="{Binding Endpoint, Mode=TwoWay}"> + <Entry.Style> + <OnPlatform x:TypeArguments="Style"> + <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> + <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> + </OnPlatform> + </Entry.Style> + </Entry> + </StackLayout> + <!-- USE LOCATIONS --> + <StackLayout + Grid.Row="2" + IsVisible="{Binding UserIsLogged}" + Style="{StaticResource SettingsStackLayoutStyle}"> + <Label + Text="{Binding TitleUseFakeLocation}" + Style="{StaticResource SettingsTitleStyle}"/> + <Label + Text="{Binding DescriptionUseFakeLocation}" + Style="{StaticResource SettingsDescriptionStyle}"/> + </StackLayout> + <!-- ON / OFF --> + <controls:ToggleButton + Grid.Column="1" + Grid.Row="2" + Checked="{Binding UseFakeLocation, Mode=TwoWay}" + Command="{Binding ToggleFakeLocationCommand}" + Style="{StaticResource SettingsToggleButtonStyle}" + IsVisible="{Binding UserIsLogged}"> + <controls:ToggleButton.CheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOn.png" /> + <On Platform="Android" Value="switch_on.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> + </OnPlatform> + </controls:ToggleButton.CheckedImage> + <controls:ToggleButton.UnCheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOff.png" /> + <On Platform="Android" Value="switch_off.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> + </OnPlatform> + </controls:ToggleButton.UnCheckedImage> + </controls:ToggleButton> + <!-- FAKE LOCATIONS --> + <StackLayout + Grid.Row="3" + Grid.ColumnSpan="2" + Style="{StaticResource SettingsStackLayoutStyle}" + IsVisible="{Binding UseFakeLocation}"> + <Label + Text="Latitude" + Style="{StaticResource HeaderLabelStyle}"/> + <Entry + Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" + Keyboard="Text"> + <Entry.Style> + <OnPlatform x:TypeArguments="Style"> + <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> + <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> + </OnPlatform> + </Entry.Style> + </Entry> + <Label + Text="Longitude" + Style="{StaticResource HeaderLabelStyle}"/> + <Entry + Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" + Keyboard="Text"> + <Entry.Style> + <OnPlatform x:TypeArguments="Style"> + <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> + <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> + </OnPlatform> + </Entry.Style> + </Entry> + <Button + Command="{Binding ToggleSendLocationCommand}" + Text="Send Location"/> + </StackLayout> + <!-- ALLOW GPS LOCATION --> + <StackLayout + Grid.Row="4" + Style="{StaticResource SettingsStackLayoutStyle}" + IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> + <Label + Text="{Binding TitleAllowGpsLocation}" + Style="{StaticResource SettingsTitleStyle}"/> + <Label + Text="{Binding DescriptionAllowGpsLocation}" + Style="{StaticResource SettingsDescriptionStyle}"/> + <Label + Text="{Binding GpsWarningMessage}" + Style="{StaticResource SettingsWarningMessageStyle}"/> + </StackLayout> + <!-- ON / OFF --> + <controls:ToggleButton + Grid.Column="1" + Grid.Row="4" + Checked="{Binding AllowGpsLocation, Mode=TwoWay}" + Command="{Binding ToggleAllowGpsLocationCommand}" + Style="{StaticResource SettingsToggleButtonStyle}" + IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> + <controls:ToggleButton.CheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOn.png" /> + <On Platform="Android" Value="switch_on.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> + </OnPlatform> + </controls:ToggleButton.CheckedImage> + <controls:ToggleButton.UnCheckedImage> + <OnPlatform x:TypeArguments="ImageSource"> + <On Platform="iOS" Value="switchOff.png" /> + <On Platform="Android" Value="switch_off.png" /> + <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> + </OnPlatform> + </controls:ToggleButton.UnCheckedImage> + </controls:ToggleButton> </Grid> </ContentPage> \ No newline at end of file diff --git a/src/Services/Identity/Identity.API/Dockerfile b/src/Services/Identity/Identity.API/Dockerfile index 167b2bb25..3931a135b 100644 --- a/src/Services/Identity/Identity.API/Dockerfile +++ b/src/Services/Identity/Identity.API/Dockerfile @@ -1,22 +1,20 @@ +ARG NODE_IMAGE=node:8.11 FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/dotnet:2.1-sdk AS sdk-with-node -ENV NODE_VERSION 8.11.1 -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 microsoft/dotnet:2.1-sdk as dotnet-build +WORKDIR /src -FROM sdk-with-node AS updated-npm -RUN npm i -g npm - - -FROM updated-npm as build +FROM ${NODE_IMAGE} as node-build +WORKDIR /web +COPY src/Services/Identity/Identity.API . 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 COPY . . WORKDIR /src/src/Services/Identity/Identity.API diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index ca31685ab..cf4c39568 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -27,7 +27,6 @@ </ItemGroup> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> - <Exec Command="bower install --allow-root" /> <Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" /> </Target> diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index bf104e83b..9847ad772 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -1,26 +1,24 @@ +ARG NODE_IMAGE=node:8.11 FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/dotnet:2.1-sdk AS sdk-with-node -ENV NODE_VERSION 8.11.1 -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 microsoft/dotnet:2.1-sdk as dotnet-build +WORKDIR /src -FROM sdk-with-node AS updated-npm -RUN npm i -g npm - -FROM updated-npm as build +FROM ${NODE_IMAGE} as node-build +WORKDIR /web +COPY src/Web/WebMVC . 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 COPY . . WORKDIR /src/src/Web/WebMVC RUN dotnet restore -nowarn:msb3202,nu1503 -RUN dotnet build --no-restore -c Release -o /app FROM build AS publish RUN dotnet publish --no-restore -c Release -o /app diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index cc5b975b3..1426517d3 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -31,7 +31,6 @@ </ItemGroup> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> - <Exec Command="bower install --allow-root" /> <Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" /> </Target> diff --git a/src/Web/WebSPA/Dockerfile b/src/Web/WebSPA/Dockerfile index 68cf0988b..4e806786c 100644 --- a/src/Web/WebSPA/Dockerfile +++ b/src/Web/WebSPA/Dockerfile @@ -1,28 +1,24 @@ +ARG NODE_IMAGE=node:8.11 FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 80 -FROM microsoft/dotnet:2.1-sdk AS sdk-with-node -ENV NODE_VERSION 8.11.1 -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 microsoft/dotnet:2.1-sdk as dotnet-build +WORKDIR /src -FROM sdk-with-node AS updated-npm -RUN npm i -g npm +FROM ${NODE_IMAGE} as node-build +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 COPY . . WORKDIR /src/src/Web/WebSPA -RUN dotnet restore -nowarn:msb3202,nu1503 -RUN dotnet build --no-restore -c Release -o /app - -FROM build AS publish -RUN dotnet publish --no-restore -c Release -o /app +RUN dotnet publish -c Release -o /app FROM base AS final WORKDIR /app diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 8d390cfc4..3f6e188c3 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -94,16 +94,6 @@ <PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> </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 --> <!--