-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathe2e-test-setup.ps1
More file actions
48 lines (40 loc) · 2.26 KB
/
Copy pathe2e-test-setup.ps1
File metadata and controls
48 lines (40 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Installing PowerShell: https://docs.microsoft.com/powershell/scripting/install/installing-powershell
param(
[Parameter(Mandatory=$true)]
[string]$DockerfilePath,
[string]$ImageName="dfapp",
[string]$ContainerName="app",
[switch]$NoSetup=$false,
[switch]$NoValidation=$false,
[string]$AzuriteVersion="3.34.0",
[int]$Sleep=30
)
$ErrorActionPreference = "Stop"
if ($NoSetup -eq $false) {
# Build the docker image first, since that's the most critical step
Write-Host "Building sample app Docker container from '$DockerfilePath'..." -ForegroundColor Yellow
docker build -f $DockerfilePath -t $ImageName --progress plain .
# Next, download and start the Azurite emulator Docker image
Write-Host "Pulling down the mcr.microsoft.com/azure-storage/azurite:$AzuriteVersion image..." -ForegroundColor Yellow
docker pull "mcr.microsoft.com/azure-storage/azurite:${AzuriteVersion}"
Write-Host "Starting Azurite storage emulator using default ports..." -ForegroundColor Yellow
# --skipApiVersionCheck: the Durable extension's Azure Storage client can request a
# newer REST API version than the pinned Azurite image supports (e.g. 2026-02-06 vs
# Azurite 3.34.0's max 2025-05-05). Without this flag, Azurite rejects the request
# with "The API version <date> is not supported by Azurite", the extension fails to
# create its task hub, and every /api/* call returns HTTP 500.
docker run --name 'azurite' -p 10000:10000 -p 10001:10001 -p 10002:10002 -d "mcr.microsoft.com/azure-storage/azurite:${AzuriteVersion}" `
azurite -l /workspace -d /workspace/debug.log --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --skipApiVersionCheck
# Finally, start up the smoke test container, which will connect to the Azurite container
docker run --name $ContainerName -p 8080:80 -it --add-host=host.docker.internal:host-gateway -d `
--env 'AzureWebJobsStorage=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://host.docker.internal' `
--env 'WEBSITE_HOSTNAME=localhost:8080' `
$ImageName
}
if ($sleep -gt 0) {
# The container needs a bit more time before it can start receiving requests
Write-Host "Sleeping for $Sleep seconds to let the container finish initializing..." -ForegroundColor Yellow
Start-Sleep -Seconds $Sleep
}
# Check to see what containers are running
docker ps