diff --git a/.github/docker/windows/Dockerfile b/.github/docker/windows/Dockerfile index 4f13814a8..5cefc53d1 100644 --- a/.github/docker/windows/Dockerfile +++ b/.github/docker/windows/Dockerfile @@ -5,6 +5,13 @@ FROM mcr.microsoft.com/windows/servercore:1809-amd64 SHELL ["powershell.exe", "-NoLogo", "-NoProfile", "-ExecutionPolicy", "ByPass"] +# List of Python versions to install (with ; as delimiter) +# For example: 2.7.5;3.7.5 +# +ARG PYTHON_VERSIONS + +RUN echo ${ENV:PYTHON_VERSIONS} + # ------------------------------------------------------------------------------------------------------------ # Chocolatey # @@ -22,6 +29,15 @@ RUN choco install git.install --yes --version=2.23.0 # RUN choco install cmake --yes --version=3.15.4 --installargs 'ADD_CMAKE_TO_PATH=System' +# ------------------------------------------------------------------------------------------------------------ +# Python +# +RUN (${ENV:PYTHON_VERSIONS}).Split(";") | ForEach-Object { \ + ${PYTHON_VERSION} = $_ \ + ${PYTHON_VERSION_CODE} += ( $PYTHON_VERSION.Split(".")[0..1] -Join '' ) \ + choco install python --yes --version=${PYTHON_VERSION} --installargs='TargetDir=""C:\python${PYTHON_VERSION_CODE}"" CompileAll=""1" Shortcuts=0' \ +} + # ------------------------------------------------------------------------------------------------------------ # pwsh (PowerShellCore) # diff --git a/.github/workflows/windows-docker-image.yaml b/.github/workflows/windows-docker-image.yaml index 6c4c3e281..cd8b26acb 100644 --- a/.github/workflows/windows-docker-image.yaml +++ b/.github/workflows/windows-docker-image.yaml @@ -30,6 +30,7 @@ jobs: runs-on: windows-2019 steps: + - name: Login to docker repository run: | ${gh_user} = ("${{ github.repository }}" -Split '/')[0] @@ -42,5 +43,9 @@ jobs: ${gh_user} = ("${{ github.repository }}" -Split '/')[0] cd .github\docker\windows - docker build --tag ${gh_user}/rez-test-win:${ENV:DOCKER_TAG} . + echo docker build --tag ${gh_user}/rez-test-win:${ENV:DOCKER_TAG} --build-arg PYTHON_VERSIONS=${ENV:PYTHON_VERSIONS} . + docker build --tag ${gh_user}/rez-test-win:${ENV:DOCKER_TAG} --build-arg PYTHON_VERSIONS=${ENV:PYTHON_VERSIONS} . docker push ${gh_user}/rez-test-win:${ENV:DOCKER_TAG} + env: + # Must match strategy in windows-docker.yaml + PYTHON_VERSIONS: '2.7.11;3.6.8;3.7.5'