Add Azure App Service site extension
This commit is contained in:
Родитель
f4b08a9f77
Коммит
61167abc10
|
@ -5,3 +5,5 @@
|
|||
*.cmd text eol=crlf
|
||||
*.bat text eol=crlf
|
||||
*.ps1 text eol=crlf
|
||||
*.xdt text eol=crlf
|
||||
*.nuspec text eol=crlf
|
||||
|
|
|
@ -26,6 +26,7 @@ var/
|
|||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
*.nupkg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.webServer>
|
||||
<runtime xdt:Transform="Insert">
|
||||
<environmentVariables>
|
||||
<add name="BATCH_SHIPYARD_CMD" value="%HOME%\batch-shipyard\shipyard.cmd" />
|
||||
</environmentVariables>
|
||||
</runtime>
|
||||
</system.webServer>
|
||||
<system.applicationHost>
|
||||
<sites>
|
||||
<site name="%XDT_SCMSITENAME%" xdt:Locator="Match(name)">
|
||||
<application path="/batch-shipyard" xdt:Locator="Match(path)" xdt:Transform="Remove" />
|
||||
<application path="/batch-shipyard" preloadEnabled="%XDT_PRELOADENABLED%" xdt:Transform="Insert">
|
||||
<virtualDirectory path="/" physicalPath="%XDT_EXTENSIONPATH%" />
|
||||
</application>
|
||||
</site>
|
||||
</sites>
|
||||
</system.applicationHost>
|
||||
</configuration>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>batch-shipyard</id>
|
||||
<version>0.0.1.8</version>
|
||||
<title>Batch Shipyard</title>
|
||||
<authors>Fred Park</authors>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>Execute jobs on Azure Batch via Batch Shipyard. Requires Python.</description>
|
||||
<iconUrl>https://azurecomcdn.azureedge.net/cvt-351112a289cff390998cc55a66a04f540f6cecfdeffbeac6a482ab886a841f7c/images/page/services/batch/100x-scale.png</iconUrl>
|
||||
<projectUrl>https://github.com/Azure/batch-shipyard</projectUrl>
|
||||
<licenseUrl>https://github.com/Azure/batch-shipyard/blob/master/LICENSE</licenseUrl>
|
||||
<copyright>Microsoft</copyright>
|
||||
<releaseNotes>https://github.com/Azure/batch-shipyard/blob/master/CHANGELOG.md</releaseNotes>
|
||||
<tags>azure batch shipyard docker containers python</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="*.cmd" target="content" />
|
||||
<file src="applicationHost.xdt" target="content" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,49 @@
|
|||
@echo off
|
||||
|
||||
REM get installed python exe and dir
|
||||
pushd %HOME%\python*
|
||||
SET PYTHONHOME=%cd%
|
||||
SET PYTHON=%PYTHONHOME%\python.exe
|
||||
IF NOT EXIST "%PYTHON%" (
|
||||
echo "%PYTHON%" does not exist!
|
||||
exit /b 1
|
||||
)
|
||||
popd
|
||||
|
||||
REM ensure git is in path
|
||||
where git.exe
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo "git not found"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM git clone repo
|
||||
taskkill /F /IM python.exe
|
||||
SET CLONEDIR=%HOME%\batch-shipyard
|
||||
IF EXIST "%CLONEDIR%" (
|
||||
rd /s /q "%CLONEDIR%"
|
||||
)
|
||||
git clone "https://github.com/Azure/batch-shipyard.git" "%CLONEDIR%"
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo "git clone failed"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM create cmd file
|
||||
(echo @echo off) > "%CLONEDIR%\shipyard.cmd"
|
||||
(echo SET PYTHON=%PYTHON%) >> "%CLONEDIR%\shipyard.cmd"
|
||||
type shipyard.cmd >> "%CLONEDIR%\shipyard.cmd"
|
||||
|
||||
REM install requirements
|
||||
pushd "%CLONEDIR%"
|
||||
"%PYTHON%" -m pip install --upgrade appdirs packaging six
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo "pip install pre-requisites failed"
|
||||
exit /b 1
|
||||
)
|
||||
"%PYTHON%" -m pip install --upgrade -r requirements.txt
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
echo "pip install requirements.txt failed"
|
||||
exit /b 1
|
||||
)
|
||||
popd
|
|
@ -0,0 +1,3 @@
|
|||
setlocal enabledelayedexpansion
|
||||
|
||||
"%PYTHON%" -u "%HOME%\batch-shipyard\shipyard.py"
|
|
@ -0,0 +1,9 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM kill any python.exe running
|
||||
taskkill /F /IM python.exe
|
||||
SET CLONEDIR=%HOME%\batch-shipyard
|
||||
IF EXIST "%CLONEDIR%" (
|
||||
rd /s /q "%CLONEDIR%"
|
||||
)
|
Загрузка…
Ссылка в новой задаче