Skip to content

Commit b978f08

Browse files
Configure website deployment
1 parent dc7932b commit b978f08

File tree

6 files changed

+89
-2
lines changed

6 files changed

+89
-2
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.venv
2+
Dockerfile
3+
.git
4+
.vscode
5+
.github
6+
__pycache__
7+
*.pyc
8+
*.pyo
9+
*.pyd
10+
dist

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [ "main", "feature/deployment" ] # TODO leave only main
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
deploy:
12+
environment: website-prod
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Azure login
19+
uses: azure/login@v2
20+
with:
21+
creds: ${{ secrets.AZURE_CREDENTIALS }}
22+
23+
- name: Install Azure CLI
24+
uses: pietrobolcato/install-azure-cli-action@main
25+
26+
- name: Run Deploy.ps1
27+
shell: pwsh
28+
run: ./Deploy.ps1 `
29+
-resourceGroupName ${{ secrets.AZURE_RESOURCE_GROUP }} `
30+
-appName ${{ secrets.AZURE_APP_NAME }} `
31+
-acrName ${{ secrets.AZURE_ACR_NAME }}

Deploy.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
param(
2+
[Parameter(Mandatory)]
3+
[string] $resourceGroupName,
4+
5+
[Parameter(Mandatory)]
6+
[string] $appName,
7+
8+
[Parameter(Mandatory)]
9+
[string] $acrName
10+
)
11+
12+
$imageName = "uipath-dev-python:$(Get-Date -Format 'yyyyMMddHHmmss')"
13+
$acrImageName = "$($acrName).azurecr.io/$($imageName)"
14+
15+
az acr login --name $acrName
16+
17+
docker build -t $imageName $PSScriptRoot
18+
docker tag $imageName $acrImageName
19+
docker push $acrImageName
20+
21+
az webapp config container set `
22+
--resource-group $resourceGroupName `
23+
--name $appName `
24+
--container-image-name $acrImageName
25+
26+
az webapp restart `
27+
--resource-group $resourceGroupName `
28+
--name $appName

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.11.14-bookworm
2+
3+
WORKDIR /app
4+
5+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
6+
COPY . /app/
7+
8+
RUN chmod +x start.sh
9+
10+
ENV UIPATH_DEV_SERVER_PORT=80
11+
ENV UIPATH_DEV_SERVER_HOST=0.0.0.0
12+
13+
CMD ["/bin/sh", "/app/start.sh"]

src/uipath/dev/server/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def __init__(
5252
self,
5353
runtime_factory: UiPathRuntimeFactoryProtocol,
5454
trace_manager: UiPathTraceManager,
55-
host: str = "localhost",
56-
port: int = 8000,
55+
host: str = os.environ.get('UIPATH_DEV_SERVER_HOST', 'localhost'),
56+
port: int = int(os.environ.get('UIPATH_DEV_SERVER_PORT', '8080')),
5757
open_browser: bool = True,
5858
factory_creator: Callable[[], UiPathRuntimeFactoryProtocol] | None = None,
5959
) -> None:

start.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# !/bin/sh
2+
/root/.local/bin/uv venv --clear
3+
. ./.venv/bin/activate
4+
/root/.local/bin/uv sync
5+
/root/.local/bin/uv run uipath-dev-server

0 commit comments

Comments
 (0)