From abf83ba5054773b2e1a534bcfc6118dacc203e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 24 Feb 2017 14:11:23 +0300 Subject: [PATCH] Docker configuration for Identity Api host. --- build/build.ps1 | 31 +++++++++++++----- docker/docker-compose.yml | 6 ++++ docker/up.ps1 | 1 + src/AbpDesk/AbpDesk.MongoBlog/project.json | 4 +++ src/AbpDesk/AbpDesk.Web.Mvc/Dockerfile | 4 ++- src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs | 2 +- .../AbpDesk.Web.Mvc/appsettings.Staging.json | 8 ++++- src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll | Bin 13824 -> 13824 bytes src/Volo.Abp.Identity.HttpApi.Host/Dockerfile | 6 ++++ .../project.json | 4 ++- 10 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 src/Volo.Abp.Identity.HttpApi.Host/Dockerfile diff --git a/build/build.ps1 b/build/build.ps1 index 04cfc1cd43..c594ce2280 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -1,35 +1,50 @@ # COMMON PATHS -$buildFolder = (Get-Item -Path ".\" -Verbose).FullName -$slnFolder = Join-Path $buildFolder "..\" +$buildFolder = (Get-Item -Path "./" -Verbose).FullName +$slnFolder = Join-Path $buildFolder "../" $outputFolder = Join-Path $buildFolder "outputs" $abpDeskFolder = Join-Path $slnFolder "src/AbpDesk" $abpDeskWebFolder = Join-Path $abpDeskFolder "AbpDesk.Web.Mvc" -# CLEAR +## CLEAR ###################################################################### Remove-Item $outputFolder -Force -Recurse New-Item -Path $outputFolder -ItemType Directory -# BUILD +## RESTORE NUGET PACKAGES ##################################################### Set-Location $slnFolder dotnet restore -# PUBLISH +## PUBLISH ASPDESK WEB ######################################################## Set-Location $abpDeskWebFolder dotnet publish --output (Join-Path $outputFolder "AbpDesk/Web") -# CREATE DOCKER IMAGES +New-Item -Path (Join-Path $outputFolder "AbpDesk/Web/PlugIns") -ItemType Directory +Copy-Item (Join-Path $abpDeskFolder "Web_PlugIns/*") (Join-Path $outputFolder "AbpDesk/Web/PlugIns/") + +## PUBLISH IDENTITY HTTP API HOST ############################################# + +Set-Location (Join-Path $slnFolder "src/Volo.Abp.Identity.HttpApi.Host") +dotnet publish --output (Join-Path $outputFolder "AbpIdentity/HttpApiHost") + +## CREATE DOCKER IMAGES ####################################################### Set-Location (Join-Path $outputFolder "AbpDesk/Web") docker rmi abpdesk/web -f docker build -t abpdesk/web . -Copy-Item (Join-Path $slnFolder "/docker/*.*") $outputFolder +Set-Location (Join-Path $outputFolder "AbpIdentity/HttpApiHost") + +docker rmi abpidentity/httpapihost -f +docker build -t abpidentity/httpapihost . + +## DOCKER COMPOSE FILES ####################################################### + +Copy-Item (Join-Path $slnFolder "docker/*.*") $outputFolder -# FINALIZE +## FINALIZE ################################################################### Set-Location $outputFolder \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 31ef19ed96..e4a500782b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,6 +1,12 @@ version: '2' services: + abpidentity_httpapihost: + image: abpidentity/httpapihost + environment: + - ASPNETCORE_ENVIRONMENT=Staging + ports: + - 9101:80 abpdesk_web: image: abpdesk/web environment: diff --git a/docker/up.ps1 b/docker/up.ps1 index f1a7e701c2..267d114cc0 100644 --- a/docker/up.ps1 +++ b/docker/up.ps1 @@ -1,4 +1,5 @@ docker rm $(docker ps -aq) +docker-compose up -d abpidentity_httpapihost docker-compose up -d abpdesk_web sleep 2 docker-compose scale abpdesk_web=2 diff --git a/src/AbpDesk/AbpDesk.MongoBlog/project.json b/src/AbpDesk/AbpDesk.MongoBlog/project.json index c3cd0cc63f..750885ddd4 100644 --- a/src/AbpDesk/AbpDesk.MongoBlog/project.json +++ b/src/AbpDesk/AbpDesk.MongoBlog/project.json @@ -18,5 +18,9 @@ "Areas/**/*.*" ] } + }, + + "scripts": { + "postcompile": [ "xcopy %compile:OutputDir%\\AbpDesk.MongoBlog.dll ..\\Web_PlugIns" ] } } diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Dockerfile b/src/AbpDesk/AbpDesk.Web.Mvc/Dockerfile index ef8ba190bf..35dbafd45e 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Dockerfile +++ b/src/AbpDesk/AbpDesk.Web.Mvc/Dockerfile @@ -1,7 +1,9 @@ FROM microsoft/aspnetcore WORKDIR /app - COPY . . +RUN mkdir /Web_PlugIns +RUN mv /app/PlugIns/*.* /Web_PlugIns + ENTRYPOINT ["dotnet", "AbpDesk.Web.Mvc.dll"] \ No newline at end of file diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs b/src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs index 2010081c60..cb00f5d22c 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs +++ b/src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs @@ -27,7 +27,7 @@ namespace AbpDesk.Web.Mvc options.PlugInSources.AddFolder( Path.Combine( _env.ContentRootPath, - @"..\Web_PlugIns\") + @"../Web_PlugIns/") ); }); } diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/appsettings.Staging.json b/src/AbpDesk/AbpDesk.Web.Mvc/appsettings.Staging.json index 3a6dc58fce..e981ad9be7 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/appsettings.Staging.json +++ b/src/AbpDesk/AbpDesk.Web.Mvc/appsettings.Staging.json @@ -1,5 +1,11 @@ { "ConnectionStrings": { - "Default": "Server=192.168.1.36;Database=AbpDesk;User=sa;Password=123qwe;" + "Default": "Server=192.168.1.36;Database=AbpDesk;User=sa;Password=123qwe;", + "AbpDeskMongoBlog": "mongodb://192.168.1.36:27017|AbpDeskBlog" + }, + "AbpIdentity": { + "HttpProxy": { + "ApiUrlBase": "http://192.168.1.36:9101/" + } } } diff --git a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll index 2f9de9f3270297052b08194f0f3873011596672b..e8df7e287755323a25f7686b17c8810f5f61c813 100644 GIT binary patch delta 64 zcmZq3X~>z-!L;Y?#;$D&0vtRCZM5ES`AmEI*^W~yhJSN_;tXz}z-!Q^^pW7jqXfdi}4`CtBSc4!wV_g|YgZ^GsP#Tnc{$;q#Dqy$*_9lO1! URk-f7G(T4QMep2Z5#2W&0Hi=0-2eap diff --git a/src/Volo.Abp.Identity.HttpApi.Host/Dockerfile b/src/Volo.Abp.Identity.HttpApi.Host/Dockerfile new file mode 100644 index 0000000000..853a01fe0b --- /dev/null +++ b/src/Volo.Abp.Identity.HttpApi.Host/Dockerfile @@ -0,0 +1,6 @@ +FROM microsoft/aspnetcore + +WORKDIR /app +COPY . . + +ENTRYPOINT ["dotnet", "Volo.Abp.Identity.HttpApi.Host.dll"] \ No newline at end of file diff --git a/src/Volo.Abp.Identity.HttpApi.Host/project.json b/src/Volo.Abp.Identity.HttpApi.Host/project.json index db1c281c1f..6a6e58b1ef 100644 --- a/src/Volo.Abp.Identity.HttpApi.Host/project.json +++ b/src/Volo.Abp.Identity.HttpApi.Host/project.json @@ -50,7 +50,9 @@ "include": [ "wwwroot", "web.config", - "appsettings.json" + "appsettings.json", + "appsettings.Staging.json", + "Dockerfile" ] },