зеркало из https://github.com/Azure/blobxfer.git
Add Windows Docker image build
This commit is contained in:
Родитель
3dc9c4bc86
Коммит
4bbba17e4a
34
appveyor.yml
34
appveyor.yml
|
@ -1,3 +1,5 @@
|
|||
image: Visual Studio 2017
|
||||
|
||||
version: '{branch}-{build}'
|
||||
|
||||
clone_depth: 5
|
||||
|
@ -19,6 +21,11 @@ environment:
|
|||
secure: b/A4QFUftPz5dFIU1JTphCV+EfZYW5p7bdgUphoESiRK7t/wiWGhudaDWzI25CA/bfGpHOMW+roeqyKKaYNU6hooXQOLajTmwieKLxdvwXZ+M76PxG301qnQvPW6GlmX9zDYaCE/6jxvxQDfGCJvVw==
|
||||
BLOBXFER_STORAGE_ACCOUNT:
|
||||
secure: qbpOW+pGmGfG7DFFC7LozA==
|
||||
DOCKER_USERNAME:
|
||||
secure: S8n3Geq7JUkN7ZQKXo8CLg==
|
||||
DOCKER_PASSWORD:
|
||||
secure: BcI2Fs6IJeTfPq8cAD4KEQ==
|
||||
DOCKER_IMAGE_TAG_PREFIX: "alfpark/blobxfer:"
|
||||
|
||||
init:
|
||||
- echo %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
|
||||
|
@ -45,6 +52,33 @@ after_test:
|
|||
appveyor PushArtifact "bin\\%BLOBXFER_ARTIFACT%" &&
|
||||
bin\\%BLOBXFER_ARTIFACT% upload --remote-path releases/%APPVEYOR_REPO_TAG_NAME% --local-path bin\\%BLOBXFER_ARTIFACT% --strip-components 1 --file-md5 --overwrite
|
||||
)
|
||||
- ps: >-
|
||||
if ($Env:PYTHON_VERSION -eq "3.5") {
|
||||
$DOCKER_IMAGE_TAG_SUFFIX = $null
|
||||
if ($Env:APPVEYOR_REPO_TAG -eq "true") {
|
||||
$DOCKER_IMAGE_TAG_SUFFIX = $Env:APPVEYOR_REPO_TAG_NAME + '-windows'
|
||||
}
|
||||
elseif ($Env:APPVEYOR_REPO_BRANCH -eq "master") {
|
||||
$DOCKER_IMAGE_TAG_SUFFIX = 'latest-windows'
|
||||
}
|
||||
elseif ($Env:APPVEYOR_REPO_BRANCH -eq "develop") {
|
||||
$DOCKER_IMAGE_TAG_SUFFIX = 'develop-windows'
|
||||
}
|
||||
if ($DOCKER_IMAGE_TAG_SUFFIX -eq $null) {
|
||||
Write-Host "Image tag suffix is null, not creating a Docker image"
|
||||
return
|
||||
}
|
||||
$DOCKER_IMAGE_TAG = $Env:DOCKER_IMAGE_TAG_PREFIX + $DOCKER_IMAGE_TAG_SUFFIX
|
||||
Write-Host "Creating image with tag: $DOCKER_IMAGE_TAG"
|
||||
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -Update -Force
|
||||
Start-Service docker
|
||||
docker version
|
||||
pushd docker\\win
|
||||
docker build --build-arg GIT_BRANCH=$Env:APPVEYOR_REPO_BRANCH --build-arg GIT_COMMIT=$Env:APPVEYOR_REPO_COMMIT -t $DOCKER_IMAGE_TAG .
|
||||
docker login -u="$Env:DOCKER_USERNAME" -p="$Env:DOCKER_PASSWORD"
|
||||
docker push $DOCKER_IMAGE_TAG
|
||||
popd
|
||||
}
|
||||
|
||||
deploy:
|
||||
- provider: GitHub
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# Dockerfile for Azure/blobxfer (Windows)
|
||||
# Adapted from: https://github.com/StefanScherer/dockerfiles-windows/blob/master/python/Dockerfile
|
||||
|
||||
FROM python:3.6.2-windowsservercore
|
||||
|
||||
ENV chocolateyUseWindowsCompression false
|
||||
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
|
||||
choco install --no-progress -y git -params "/GitAndUnixToolsOnPath"
|
||||
|
||||
ARG GIT_BRANCH
|
||||
ARG GIT_COMMIT
|
||||
|
||||
WORKDIR C:\\blobxfer
|
||||
RUN git clone -b $Env:GIT_BRANCH --single-branch --depth 5 https://github.com/Azure/blobxfer.git C:\blobxfer ; \
|
||||
git checkout $Env:GIT_COMMIT ; \
|
||||
pip install --no-cache-dir -e . ; \
|
||||
python setup.py install
|
||||
|
||||
RUN python -m compileall C:\Python\Lib ; \
|
||||
exit 0
|
||||
|
||||
FROM microsoft/nanoserver
|
||||
|
||||
COPY --from=0 /Python /Python
|
||||
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
ENV PYTHON_VERSION 3.6.2
|
||||
ENV PYTHON_PIP_VERSION 9.0.1
|
||||
|
||||
RUN $env:PATH = 'C:\Python;C:\Python\Scripts;{0}' -f $env:PATH ; \
|
||||
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
|
||||
mkdir $env:APPDATA\Python\Python36\site-packages ; \
|
||||
Invoke-WebRequest 'https://bootstrap.pypa.io/get-pip.py' -OutFile 'get-pip.py' -UseBasicParsing ; \
|
||||
$replace = ('import tempfile{0}import site{0}site.getusersitepackages()' -f [char][int]10) ; \
|
||||
Get-Content get-pip.py | Foreach-Object { $_ -replace 'import tempfile', $replace } | Out-File -Encoding Ascii getpip.py ; \
|
||||
$pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION) ; \
|
||||
python getpip.py $pipInstall ; \
|
||||
Remove-Item get-pip.py ; \
|
||||
Remove-Item getpip.py
|
||||
|
||||
ENTRYPOINT ["blobxfer"]
|
Загрузка…
Ссылка в новой задаче