Skip to content

Commit

Permalink
docker: add windows build dockerfiles (#1513)
Browse files Browse the repository at this point in the history
* docker: add windows build dockerfiles

* swith to 2016

* try using cywgin cache

* fix removal of quotes from path

* testing path

* refactor

* Update build_windows.yml

* fix VS2013 install

* switch to cygwin install again

* try cygwin bug workaround

* revert to slow workaround for now

* use pigz

* try cygwin fix
  • Loading branch information
gdams authored Oct 6, 2020
1 parent e0c12e3 commit 50ecd9d
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 1 deletion.
Binary file added .github/cygwin-build/setup-x86_64.exe
Binary file not shown.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
branches:
- master


jobs:
build-and-push-centos6:
name: Centos6
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Windows

on:
pull_request:
paths:
- ansible/DockerFile.Windows2016_Base
- ansible/Dockerfile.Windows2016_VS2013
- ansible/Dockerfile.Windows2016_VS2017
branches:
- master
push:
paths:
- ansible/DockerFile.Windows2016_Base
- ansible/Dockerfile.Windows2016_VS2013
- ansible/Dockerfile.Windows2016_VS2017
branches:
- master

jobs:
build-and-push-windows2016:
name: Windows 2016
runs-on: windows-2016
steps:

- uses: actions/checkout@v2

- name: Docker Build Windows 2016 Base Image to Docker Hub
run: docker build -t adoptopenjdk/windows2016_build_image:base -f ansible/Dockerfile.windows2016_Base .

- name: Docker Build Windows 2016 VS2017 Image to Docker Hub
run: docker build -t adoptopenjdk/windows2016_build_image:vs2017 -f ansible/Dockerfile.windows2016_VS2017 .

- name: Push Windows images to Docker Hub
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push adoptopenjdk/windows2016_build_image:base
docker push adoptopenjdk/windows2016_build_image:vs2017
if: github.ref == 'refs/heads/master'
53 changes: 53 additions & 0 deletions ansible/Dockerfile.Windows2016_Base
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# escape=`

FROM mcr.microsoft.com/windows/servercore:ltsc2016

SHELL ["powershell", "-command"]

# Workaround for https://github.com/moby/moby/issues/41058
ENV CYGWIN winsymlinks:lnk
ADD .github/cygwin-build/setup-x86_64.exe C:\temp\cygwin.exe

RUN $ProgressPreference = 'SilentlyContinue'; `
# pre install
New-Item -Path C:\ -Name 'openjdk' -ItemType 'directory'; `
# cygwin
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
# Invoke-WebRequest -UseBasicParsing 'https://cygwin.com/setup-x86_64.exe' -OutFile 'C:\temp\cygwin.exe'; `
Start-Process -Wait -FilePath 'C:\temp\cygwin.exe' -ArgumentList '--packages autoconf,automake,bsdtar,cpio,curl,gcc-core,git,gnupg,grep,libtool,make,mingw64-x86_64-gcc-core,perl,rsync,unzip,wget,zip --quiet-mode --download --no-admin --local-install --delete-orphans --site https://mirrors.kernel.org/sourceware/cygwin/ --local-package-dir C:\cygwin_packages --root C:\cygwin64'; `
# change git config to not replace Line endings
C:\cygwin64\bin\git config --system core.autocrlf false ; `
# perl
Invoke-WebRequest 'http://strawberryperl.com/download/5.26.0.1/strawberry-perl-5.26.0.1-64bit.zip' -OutFile C:\temp\strawberry-perl.zip; `
Expand-Archive -LiteralPath C:\temp\strawberry-perl.zip -DestinationPath C:\Strawberry; `
Start-Process -Wait -FilePath C:\Strawberry\perl\bin\perl -ArgumentList '-MCPAN -e "install Text::CSV_XS"'; `
# git
Invoke-WebRequest 'http://github.com/git-for-windows/git/releases/download/v2.14.3.windows.1/Git-2.14.3-64-bit.exe' -OutFile C:\temp\git.exe; `
Start-Process -Wait -FilePath C:\temp\git.exe -ArgumentList '/SILENT /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh"'; `
# java 7
Invoke-WebRequest 'http://download.java.net/openjdk/jdk7u75/ri/jdk_ri-7u75-b13-windows-i586-18_dec_2014.zip' -OutFile C:\temp\jdk7u75-b13.zip; `
Expand-Archive -LiteralPath C:\temp\jdk7u75-b13.zip -DestinationPath 'C:\Program Files\Java'; `
New-Item -ItemType SymbolicLink -Path C:\openjdk\jdk-7 -Target 'C:\Program Files\Java\java-se-7u75-ri'; `
# java 8
Invoke-WebRequest 'https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u265-b01/OpenJDK8U-jdk_x86-32_windows_hotspot_8u265b01.zip' -OutFile C:\temp\jdk-8.zip; `
Expand-Archive -LiteralPath C:\temp\jdk-8.zip -DestinationPath 'C:\Program Files\Java'; `
New-Item -ItemType SymbolicLink -Path C:\openjdk\jdk-8 -Target 'C:\Program Files\Java\jdk8u265-b01'; `
# set env
[Environment]::SetEnvironmentVariable('JDK7_BOOT_DIR', '/cygdrive/c/openjdk/jdk-7', [EnvironmentVariableTarget]::Machine); `
[Environment]::SetEnvironmentVariable('JDK8_BOOT_DIR', '/cygdrive/c/openjdk/jdk-8', [EnvironmentVariableTarget]::Machine); `
# ant
Invoke-WebRequest 'http://archive.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip' -OutFile C:\temp\ant.zip; `
Expand-Archive -LiteralPath C:\temp\ant.zip -DestinationPath C:\apache-ant\; `
# ant-contrib
Invoke-WebRequest 'http://astuteinternet.dl.sourceforge.net/project/ant-contrib/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip' -OutFile C:\temp\ant-contrib.zip; `
Expand-Archive -LiteralPath C:\temp\ant-contrib.zip -DestinationPath C:\temp\ant-contrib; `
Copy-Item -Path C:\temp\ant-contrib\ant-contrib\lib\ant-contrib.jar -Destination C:\apache-ant\apache-ant-1.10.5\lib\ant-contrib.jar; `
# set env
[Environment]::SetEnvironmentVariable('ANT_HOME', 'C:\apache-ant\apache-ant-1.10.5', [EnvironmentVariableTarget]::Machine); `
[Environment]::SetEnvironmentVariable('JAVA_HOME', '/cygdrive/c/openjdk/jdk-8', [EnvironmentVariableTarget]::Machine); `
[Environment]::SetEnvironmentVariable('HOME', 'C:\Users\ContainerAdministrator', [EnvironmentVariableTarget]::Machine); `
# remove speech mark from the %PATH%
$NewPath=$env:path.Replace('\"',''); `
[Environment]::SetEnvironmentVariable('Path', 'C:\Strawberry\perl\bin;C:\openjdk\jdk-8\bin;C:\apache-ant\apache-ant-1.10.5\bin;C:\cygwin64\bin;C:\Program Files\Git\bin;' + $NewPath, [EnvironmentVariableTarget]::Machine); `
# clean up
Remove-Item C:\temp -Recurse
18 changes: 18 additions & 0 deletions ansible/Dockerfile.Windows2016_VS2017
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# escape=`

FROM adoptopenjdk/windows2016_build_image:base

SHELL ["powershell", "-command"]

RUN $ProgressPreference = 'SilentlyContinue'; `
# pre install
New-Item -Path C:\ -Name 'temp' -ItemType 'directory'; `
# VS2017 Build Tools
Invoke-WebRequest 'https://download.visualstudio.microsoft.com/download/pr/82e3dcda-e8a0-44e4-8860-eb93a12d4e80/debc235546e664edf27e81d2945921eb58e8bfec4f4e6eb271fecb9aca320b76/vs_BuildTools.exe' -OutFile C:\temp\vs2017.exe; `
Start-Process -Wait -FilePath C:\temp\vs2017.exe -ArgumentList '--wait --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.Windows10SDK.17763 --quiet --norestart'; `
regsvr32 /s 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\DIA SDK\bin\msdia140.dll'; `
regsvr32 /s 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\DIA SDK\bin\amd64\msdia140.dll'; `
# clean up
Remove-Item C:\temp -Recurse; `
Remove-Item 'C:\ProgramData\Package Cache' -Recurse; `
Remove-Item 'C:\ProgramData\Microsoft\VisualStudio\Packages' -Recurse

0 comments on commit 50ecd9d

Please sign in to comment.