diff --git a/Dockerfile b/Dockerfile index 18c4173..d4b4d32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,5 +10,7 @@ COPY . /usr/src/app/ # expose the port EXPOSE 8080 +ENV DOCKER=true + # run the server CMD [ "pwsh", "-c", "cd /usr/src/app; ./server.ps1" ] \ No newline at end of file diff --git a/server.ps1 b/server.ps1 index a035eab..599bfbf 100644 --- a/server.ps1 +++ b/server.ps1 @@ -1,5 +1,12 @@ Start-PodeServer { - Add-PodeEndpoint -Address localhost -Port 8080 -Protocol Http + # get docker environment variable + $docker = $env:DOCKER + + if ($docker) { + Add-PodeEndpoint -Address * -Port 8080 -Protocol Http + } else { + Add-PodeEndpoint -Address localhost -Port 8080 -Protocol Http + } Add-PodeRoute -Method Get -Path '/' -ScriptBlock { Write-PodeJsonResponse -Value @{ Response = 'Hello World' }