-
Notifications
You must be signed in to change notification settings - Fork 572
WCF Docker Containers #4876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
afifi-ins
wants to merge
12
commits into
dotnet:main
Choose a base branch
from
afifi-ins:users/v-aafifi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WCF Docker Containers #4876
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3186f77
WCF Docker Containers
afifi-ins 6380f49
Merge branch 'dotnet:main' into users/v-aafifi
afifi-ins c1d7638
Merge branch 'dotnet:main' into users/v-aafifi
afifi-ins 01fda6e
update docker scripts
afifi-ins e50b359
Merge branch 'dotnet:main' into users/v-aafifi
afifi-ins 300418b
Merge branch 'users/v-aafifi' of https://github.com/afifi-ins/wcf int…
afifi-ins 8e8dca9
update docker ignore
afifi-ins 200a22e
update scripts
afifi-ins e32c128
env script updates
afifi-ins 5954336
Add extra comments
afifi-ins 62bf3d1
Update NegotiateTestDomain value
afifi-ins 2f6fc7e
Merge branch 'dotnet:main' into users/v-aafifi
afifi-ins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
WCF Docker Containers
- Loading branch information
commit 3186f778cf8850ad99a31628491ecf6e258f0729
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Ignore everything | ||
| * | ||
|
|
||
| # Allow files and directories | ||
| #!global.json | ||
| #!NuGet.config | ||
| #!/eng | ||
| #!/src/System.Private.ServiceModel/tools | ||
| #!/artifacts/bin/CertificateGenerator | ||
| #!/artifacts/bin/SelfHostedWCFService |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| FROM mcr.microsoft.com/dotnet/sdk:6.0.300-focal-amd64 | ||
|
|
||
| CMD /wcf/src/System.Private.ServiceModel/tools/scripts/SetClientEnv-Linux.sh && /wcf/eng/common/cibuild.sh -configuration Release -prepareMachine -t --integrationTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 | ||
|
|
||
| SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"] | ||
|
|
||
| CMD C:\wcf\src\System.Private.ServiceModel\tools\scripts\SetClientEnv-Windows.cmd; C:\wcf\eng\common\cibuild.cmd -configuration Release -prepareMachine /p:Restore=false /p:Sign=false /p:Test=true /p:IntegrationTest=true /p:Pack=false /p:Publish=false; | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM mcr.microsoft.com/dotnet/framework/wcf | ||
|
|
||
| # IIS Hosted | ||
| EXPOSE 80 808 443 44345 | ||
|
|
||
| # Self Hosted | ||
| EXPOSE 8081 8083 8084 44285 809 | ||
|
|
||
| SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"] | ||
| ENTRYPOINT ["powershell"] | ||
|
|
||
| # Setup WCF web hosted and self hosted services - Container Startup CMD | ||
| CMD ./wcf/src/System.Private.ServiceModel/tools/scripts/SetupWcfIISHostedService.cmd 38 /p:"c:\wcf"; ./wcf/src/System.Private.ServiceModel/tools/scripts/StartWCFSelfHostedSvc.cmd; powershell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/System.Private.ServiceModel/tools/scripts/BuildSource.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| :: Build certifcate generator tool | ||
| call BuildCertUtil.cmd | ||
| :: Build Selfhosted service | ||
| call BuildWCFSelfHostedService.cmd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| :: Build tests | ||
| ::Windows Build | ||
| cd ..\..\..\..\ | ||
| call eng\common\cibuild.cmd -configuration Release -prepareMachine /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true /p:Test=false | ||
|
|
||
| ::Linux Build | ||
| ::call eng\common\cibuild.sh -configuration Release -preparemachine /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true /p:Test=false | ||
|
|
64 changes: 64 additions & 0 deletions
64
src/System.Private.ServiceModel/tools/scripts/DockerStartWCFService.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| echo off | ||
| setlocal | ||
| echo ********************************** | ||
| echo Starting WCF Service on Docker | ||
| echo ********************************** | ||
|
|
||
| set _exitCode=0 | ||
| ::todo use vars | ||
| set ServiceImageTag = "wcf:service" | ||
| set "ServiceContainerName=WCFServiceContainer" | ||
|
|
||
|
|
||
| :: Make sure docker is running | ||
| docker ps>nul 2>&1 | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Please make sure docker is running. | ||
| goto :Failure | ||
| ) | ||
|
|
||
| ::make sure we are using Windows Containers | ||
| CALL "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine | ||
|
|
||
| :: Check if WCF service is already running | ||
| FOR /F "tokens=* USEBACKQ" %%F IN (`docker container inspect -f '{{.State.Status}}' %ServiceContainerName%`) DO ( | ||
| if %%F == 'running' ( | ||
| echo. & echo WCF Service container is already running. | ||
| goto :Done | ||
| )) | ||
|
|
||
| :: change directory to wcf folder | ||
| cd ../../../.. | ||
|
|
||
| echo. & echo Building Docker image for WCF service | ||
|
|
||
| :: Building docker image. | ||
| docker build -f ./Docker/Service/Dockerfile -t wcf:service . | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Building docker image failed. | ||
| goto :Failure | ||
| ) | ||
| echo. & echo Building image success.. | ||
|
|
||
| :: Starting docker container from the image. | ||
| echo. & echo Starting WCF Service Container | ||
| :: mount current directory for wcf source as container volume - C:\wcf | ||
| docker run --name %ServiceContainerName% --rm -it -d -v "%cd%":"C:\wcf" wcf:service | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Starting WCF service container failed. | ||
| goto :Failure | ||
| ) | ||
|
|
||
| echo. & echo Started WCF Service Container. | ||
| :: print service container IP address | ||
| docker inspect --format="{{.NetworkSettings.Networks.nat.IPAddress}}" %ServiceContainerName% | ||
|
|
||
| exit /b | ||
|
|
||
| :Failure | ||
| echo. & echo Error... | ||
| set _exitCode=1 | ||
|
|
||
| :Done | ||
| exit /b %_exitCode% | ||
| endlocal |
67 changes: 67 additions & 0 deletions
67
src/System.Private.ServiceModel/tools/scripts/DockerStartWCFTest-Linux.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| echo off | ||
| setlocal | ||
| echo ********************************** | ||
| echo Starting WCF Client on Docker | ||
| echo ********************************** | ||
|
|
||
| set _exitCode=0 | ||
|
|
||
| :: Make sure docker is running | ||
| docker ps>nul 2>&1 | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Please make sure docker is running. | ||
| goto :Failure | ||
| ) | ||
|
|
||
| echo. & echo Checking WCF service container status and IP address. | ||
|
|
||
| ::Switch to Windows Containers to check WCF Service status | ||
| CALL "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine | ||
|
|
||
| :: Check if WCF service is already running | ||
| docker container inspect -f '{{.State.Status}}' WCFServiceContainer | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo Warning: WCF Service container is not running. | ||
| CALL DockerStartWCFService.cmd | ||
| ) | ||
|
|
||
| :: set ServiceUri | ||
| FOR /F "tokens=* USEBACKQ" %%F IN (`docker inspect --format="{{.NetworkSettings.Networks.nat.IPAddress}}" WCFServiceContainer`) DO ( | ||
| SET ServiceUri=%%F/WcfService38 | ||
| ) | ||
| echo %ServiceUri% | ||
|
|
||
| ::Switch to Linux Containers to run Linux tests | ||
| CALL "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchLinuxEngine | ||
|
|
||
| :: change directory to wcf src | ||
| cd ../../../.. | ||
|
|
||
| echo. & echo Building Docker image for WCF client | ||
|
|
||
| :: Building docker image. | ||
| docker build -f ./Docker/Client/Linux.dockerfile --tag=wcf:client . | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Building docker image failed. | ||
| goto :Failure | ||
| ) | ||
| echo. & echo Building image success.. | ||
|
|
||
| :: Starting docker container from the image. | ||
| echo. & echo Starting WCF client | ||
| docker run --name wcfclient_container --rm -it --memory=2g -v "%cd%":"/wcf" -e ServiceUri=%ServiceUri% wcf:client | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Starting WCF client container failed. | ||
| goto :Failure | ||
| ) | ||
|
|
||
|
|
||
| exit /b | ||
|
|
||
| :Failure | ||
| echo. & echo Error... | ||
| set _exitCode=1 | ||
|
|
||
| :Done | ||
| exit /b %_exitCode% | ||
| endlocal |
65 changes: 65 additions & 0 deletions
65
src/System.Private.ServiceModel/tools/scripts/DockerStartWCFTest-Windows.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| echo off | ||
| setlocal | ||
| echo ********************************** | ||
| echo Starting WCF Client on Docker | ||
| echo ********************************** | ||
|
|
||
| set _exitCode=0 | ||
|
|
||
| :: Make sure docker is running | ||
| docker ps>nul 2>&1 | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Please make sure docker is running. | ||
| goto :Failure | ||
| ) | ||
|
|
||
| echo. & echo Checking WCF service container status and IP address. | ||
|
|
||
| ::Switch to Windows Containers to check WCF Service status | ||
| CALL "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchWindowsEngine | ||
|
|
||
| :: Check if WCF service is already running | ||
| docker container inspect -f '{{.State.Status}}' WCFServiceContainer | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo Warning: WCF Service container is not running. | ||
| CALL DockerStartWCFService.cmd | ||
| ) | ||
|
|
||
| :: set ServiceUri | ||
| FOR /F "tokens=* USEBACKQ" %%F IN (`docker inspect --format="{{.NetworkSettings.Networks.nat.IPAddress}}" WCFServiceContainer`) DO ( | ||
| SET ServiceUri=%%F/WcfService38 | ||
| ) | ||
| echo %ServiceUri% | ||
|
|
||
| :: change directory to wcf src | ||
| cd ../../../.. | ||
|
|
||
| echo. & echo Building Docker image for WCF client | ||
|
|
||
| :: Building docker image. | ||
| docker build -f ./Docker/Client/Windows.dockerfile --tag=wcf:client . | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Building docker image failed. | ||
| goto :Failure | ||
| ) | ||
| echo. & echo Building image success.. | ||
|
|
||
| :: Starting docker container from the image. | ||
|
|
||
| echo. & echo Starting WCF client | ||
| docker run --name wcfclient_container --rm -it --memory=2g -v "%cd%":"C:\wcf" -e ServiceUri=%ServiceUri% wcf:client | ||
| if ERRORLEVEL 1 ( | ||
| echo. & echo ERROR: Starting WCF client container failed. | ||
| goto :Failure | ||
| ) | ||
|
|
||
|
|
||
| exit /b | ||
|
|
||
| :Failure | ||
| echo. & echo Error... | ||
| set _exitCode=1 | ||
|
|
||
| :Done | ||
| exit /b %_exitCode% | ||
| endlocal |
13 changes: 13 additions & 0 deletions
13
src/System.Private.ServiceModel/tools/scripts/SetClientEnv-Linux.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export Windows_Authentication_Available=true | ||
| export SPN_Available=true | ||
| export Server_Domain_Joined=true | ||
| export Ambient_Credentials_Available=true | ||
| export Domain_Available=true | ||
| export Explicit_Credentials_Available=true | ||
| export ExplicitUserName=indgaunt | ||
| export ExplicitPassword=IU872_oR4189l6_HT8 | ||
| export SSL_Available=true | ||
| export Root_Certificate_Installed=true | ||
| export Client_Certificate_Installed=true | ||
| export Peer_Certificate_Installed=true | ||
| export NegotiateTestDomain=REDMOND.CORP.MICROSOFT.COM |
13 changes: 13 additions & 0 deletions
13
src/System.Private.ServiceModel/tools/scripts/SetClientEnv-Windows.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| setx Windows_Authentication_Available true | ||
| setx Digest_Authentication_Available true | ||
| setx Ambient_Credentials_Available true | ||
| setx SPN_Available true | ||
| setx NTLM_Available true | ||
| setx Server_Domain_Joined true | ||
| setx ExplicitUserName indgaunt | ||
| setx ExplicitPassword IU872_oR4189l6_HT8 | ||
| setx Domain_Available true | ||
| setx UPN_Available true | ||
| setx Root_Certificate_Installed true | ||
| setx Client_Certificate_Installed true | ||
| setx Peer_Certificate_Installed true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason for raising the supported runtime version to 4.8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building the CertificateGenerator tool using VS 2022 Developer Command Prompt requires to install .NET 4.5 SDK/Targeting Pack manually, I thought it would be nice to upgrade the runtime version and build the tool directly. This is what I get when using .NET 4.5:
Error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks