Files
appRobotRender/setup/generateSets/create-portainer-stack.bat
2026-06-02 17:16:24 +02:00

26 lines
850 B
Batchfile

@echo off
setlocal
REM Anpassungen
set "PORTAINER_URL=https://localhost:9443"
set "API_KEY=ptr_flNQoaROQLF4L+4fHAfv7db774Exgv+pDJ04dc4W7Bs="
set "ENDPOINT_ID=1"
set "STACK_NAME=robot-renderer"
set "COMPOSE_FILE=%~dp0docker-compose.yml"
set "PAYLOAD=%TEMP%\portainer_stack_payload.json"
REM JSON-Payload aus der Compose-Datei erzeugen
powershell -NoProfile -Command ^
"$compose = Get-Content -Raw -Path '%COMPOSE_FILE%';" ^
"$obj = [ordered]@{ name = '%STACK_NAME%'; StackFileContent = $compose };" ^
"$obj | ConvertTo-Json -Compress | Set-Content -Encoding utf8 '%PAYLOAD%'"
REM Stack in Portainer anlegen
curl.exe -k -sS -X POST "%PORTAINER_URL%/api/stacks/create/standalone/string?endpointId=%ENDPOINT_ID%" ^
-H "X-API-Key: %API_KEY%" ^
-H "Content-Type: application/json" ^
--data-binary "@%PAYLOAD%"
del "%PAYLOAD%"
endlocal
pause