A PowerShell REST API running as a microservice in a Docker container.
Plus, use PowerShell's Invoke-Build
as continuous build to stop the container, rebuild the image, and then run the new container. Ready for testing.
Build and run Docker the container straight from the repo.
docker build --tag powershellmicroservice https://github.com/dfinke/PowerShellMicroservice.git
docker run -d --name powershellmicroservice -p 8080:8080 powershellmicroservice
sleep 2 # give the container a chance to spin up
Invoke-RestMethod http://localhost:8080/ # Hello from PowerShell in Docker
Install-Module InvokeBuild
Invoke-Build
Invoke-RestMethod http://localhost:8080/
hello world
Invoke-RestMethod http://localhost:8080/echo/YourData
[06/25/2020 21:13:58] echo: YourData
- Edit
StartPodeServer.ps1
- Comment out
Write-PodeTextResponse -Value 'hello world'
- Uncomment
Write-PodeTextResponse -Value 'hello world, from PowerShell in Docker'
- Save the file
Run
Invoke-Build
Try it:
Invoke-RestMethod http://localhost:8080/
hello world, from PowerShell in Docker