From 9aa67dcf9c43379755b4a3c344db84e4c70906f8 Mon Sep 17 00:00:00 2001 From: alessandromuresan Date: Thu, 19 Feb 2026 14:51:48 +0200 Subject: [PATCH] feat(deployment): configure website deployment --- .dockerignore | 10 ++++++++++ .github/workflows/deploy.yml | 31 +++++++++++++++++++++++++++++++ Deploy.ps1 | 28 ++++++++++++++++++++++++++++ Dockerfile | 13 +++++++++++++ src/uipath/dev/server/__init__.py | 4 ++-- start.sh | 5 +++++ 6 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/deploy.yml create mode 100644 Deploy.ps1 create mode 100644 Dockerfile create mode 100644 start.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2a9c3fb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.venv +Dockerfile +.git +.vscode +.github +__pycache__ +*.pyc +*.pyo +*.pyd +dist diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..bd659a3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: Deploy + +on: + push: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + deploy: + environment: website-prod + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Azure login + uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Install Azure CLI + uses: pietrobolcato/install-azure-cli-action@main + + - name: Run Deploy.ps1 + shell: pwsh + run: ./Deploy.ps1 ` + -resourceGroupName ${{ secrets.AZURE_RESOURCE_GROUP }} ` + -appName ${{ secrets.AZURE_APP_NAME }} ` + -acrName ${{ secrets.AZURE_ACR_NAME }} diff --git a/Deploy.ps1 b/Deploy.ps1 new file mode 100644 index 0000000..bdf63c5 --- /dev/null +++ b/Deploy.ps1 @@ -0,0 +1,28 @@ +param( + [Parameter(Mandatory)] + [string] $resourceGroupName, + + [Parameter(Mandatory)] + [string] $appName, + + [Parameter(Mandatory)] + [string] $acrName +) + +$imageName = "uipath-dev-python:$(Get-Date -Format 'yyyyMMddHHmmss')" +$acrImageName = "$($acrName).azurecr.io/$($imageName)" + +az acr login --name $acrName + +docker build -t $imageName $PSScriptRoot +docker tag $imageName $acrImageName +docker push $acrImageName + +az webapp config container set ` + --resource-group $resourceGroupName ` + --name $appName ` + --container-image-name $acrImageName + +az webapp restart ` + --resource-group $resourceGroupName ` + --name $appName diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d40b565 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.11.14-bookworm + +WORKDIR /app + +RUN curl -LsSf https://astral.sh/uv/install.sh | sh +COPY . /app/ + +RUN chmod +x start.sh + +ENV UIPATH_DEV_SERVER_PORT=80 +ENV UIPATH_DEV_SERVER_HOST=0.0.0.0 + +CMD ["/bin/sh", "/app/start.sh"] diff --git a/src/uipath/dev/server/__init__.py b/src/uipath/dev/server/__init__.py index 1bdfbd7..09025fc 100644 --- a/src/uipath/dev/server/__init__.py +++ b/src/uipath/dev/server/__init__.py @@ -52,8 +52,8 @@ def __init__( self, runtime_factory: UiPathRuntimeFactoryProtocol, trace_manager: UiPathTraceManager, - host: str = "localhost", - port: int = 8000, + host: str = os.environ.get("UIPATH_DEV_SERVER_HOST", "localhost"), + port: int = int(os.environ.get("UIPATH_DEV_SERVER_PORT", "8080")), open_browser: bool = True, factory_creator: Callable[[], UiPathRuntimeFactoryProtocol] | None = None, ) -> None: diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..55edc6c --- /dev/null +++ b/start.sh @@ -0,0 +1,5 @@ +# !/bin/sh +/root/.local/bin/uv venv --clear +. ./.venv/bin/activate +/root/.local/bin/uv sync +/root/.local/bin/uv run uipath-dev-server