From 14ad500636993ccb2005d6a9ecc94c8c7390c143 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Wed, 20 Jun 2018 13:01:21 -0400 Subject: [PATCH 1/4] Fixed the gpg key substituion --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index f31810256..c721ec147 100755 --- a/update.sh +++ b/update.sh @@ -121,7 +121,7 @@ function update_node_version() { for key_type in "node" "yarn"; do while read -r line; do pattern='"\$\{'$(echo "${key_type}" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"' - sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}" + sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}-tmp" done <"keys/${key_type}.keys" sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp" done From 8bd6d484c2ba8cb63d47e5a42d84fe43e2d78d40 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Wed, 20 Jun 2018 13:02:28 -0400 Subject: [PATCH 2/4] Fixed the update script not working properly with the -s flag or variant filter --- functions.sh | 4 ++-- update.sh | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/functions.sh b/functions.sh index acc2fd868..24d17aa36 100755 --- a/functions.sh +++ b/functions.sh @@ -58,7 +58,7 @@ function get_variants() { local arch local availablevariants local variantsfilter - local variants + local variants=() arch=$(get_arch) variantsfilter=("$@") @@ -143,7 +143,7 @@ function get_versions() { prefix=${1:-.} shift - local versions + local versions=() local dirs=("$@") local default_variant diff --git a/update.sh b/update.sh index c721ec147..013293a08 100755 --- a/update.sh +++ b/update.sh @@ -29,6 +29,7 @@ while getopts "sh" opt; do case "${opt}" in s) SKIP=true + shift ;; h) usage @@ -46,7 +47,8 @@ done cd "$(cd "${0%/*}" && pwd -P)" IFS=' ' read -ra versions <<<"$(get_versions .)" -IFS=' ' read -ra update_versions <<<"$(get_versions . "$@")" +IFS=' ' read -ra update_versions <<<"$(get_versions . "${1-}")" +IFS=' ' read -ra update_variants <<<"$(get_variants . "${2-}")" if [ ${#versions[@]} -eq 0 ]; then fatal "No valid versions found!" fi @@ -65,6 +67,11 @@ fi function in_versions_to_update() { local version=$1 + if [ "${#update_versions[@]}" -eq 0 ]; then + echo 0 + return + fi + for version_to_update in "${update_versions[@]}"; do if [ "${version_to_update}" = "${version}" ]; then echo 0 @@ -75,6 +82,24 @@ function in_versions_to_update() { echo 1 } +function in_variants_to_update() { + local variant=$1 + + if [ "${#update_variants[@]}" -eq 0 ]; then + echo 0 + return + fi + + for variant_to_update in "${update_variants[@]}"; do + if [ "${variant_to_update}" = "${variant}" ]; then + echo 0 + return + fi + done + + echo 1 +} + function update_node_version() { local baseuri=${1} @@ -164,9 +189,9 @@ for version in "${versions[@]}"; do parentpath=$(dirname "${version}") versionnum=$(basename "${version}") baseuri=$(get_config "${parentpath}" "baseuri") - update=$(in_versions_to_update "${version}") + update_version=$(in_versions_to_update "${version}") - [ "${update}" -eq 0 ] && info "Updating version ${version}..." + [ "${update_version}" -eq 0 ] && info "Updating version ${version}..." # Get supported variants according the target architecture # See details in function.sh @@ -175,7 +200,7 @@ for version in "${versions[@]}"; do if [ -f "${version}/Dockerfile" ]; then add_stage "${baseuri}" "${version}" "default" - if [ "${update}" -eq 0 ]; then + if [ "${update_version}" -eq 0 ]; then update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" & fi fi @@ -185,7 +210,9 @@ for version in "${versions[@]}"; do [ -f "${version}/${variant}/Dockerfile" ] || continue add_stage "${baseuri}" "${version}" "${variant}" - if [ "${update}" -eq 0 ]; then + update_variant=$(in_variants_to_update "${variant}") + + if [ "${update_version}" -eq 0 ] && [ "${update_variant}" -eq 0 ]; then update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile-${variant}.template" "${version}/${variant}/Dockerfile" "${variant}" & fi done From 49ae00df41d1105aeec370979c9c5bdc90b308c7 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Fri, 1 Jun 2018 09:59:24 -0400 Subject: [PATCH 3/4] Introduce Windows Docker images Co-authored-by: Stefan Scherer Co-authored-by: Laurent Goderre --- travis.yml.template => .travis.yml.template | 0 10/windows/nanoserver/Dockerfile | 60 ++++++++++++++++++ 10/windows/windowsservercore/Dockerfile | 60 ++++++++++++++++++ 6/windows/nanoserver/Dockerfile | 60 ++++++++++++++++++ 6/windows/windowsservercore/Dockerfile | 60 ++++++++++++++++++ 8/windows/nanoserver/Dockerfile | 60 ++++++++++++++++++ 8/windows/windowsservercore/Dockerfile | 60 ++++++++++++++++++ 9/windows/nanoserver/Dockerfile | 60 ++++++++++++++++++ 9/windows/windowsservercore/Dockerfile | 60 ++++++++++++++++++ Dockerfile-nanoserver.template | 52 ++++++++++++++++ Dockerfile-windowsservercore.template | 52 ++++++++++++++++ appveyor.yml | 57 +++++++++++++++++ appveyor.yml.template | 23 +++++++ architectures | 1 + config | 1 + functions.sh | 18 +++++- generate-stackbrew-library.sh | 21 +++++++ test-build.ps1 | 68 +++++++++++++++++++++ test-build.sh | 2 +- test-image.ps1 | 18 ++++++ update.sh | 51 +++++++++++++--- 21 files changed, 833 insertions(+), 11 deletions(-) rename travis.yml.template => .travis.yml.template (100%) create mode 100644 10/windows/nanoserver/Dockerfile create mode 100644 10/windows/windowsservercore/Dockerfile create mode 100644 6/windows/nanoserver/Dockerfile create mode 100644 6/windows/windowsservercore/Dockerfile create mode 100644 8/windows/nanoserver/Dockerfile create mode 100644 8/windows/windowsservercore/Dockerfile create mode 100644 9/windows/nanoserver/Dockerfile create mode 100644 9/windows/windowsservercore/Dockerfile create mode 100644 Dockerfile-nanoserver.template create mode 100644 Dockerfile-windowsservercore.template create mode 100644 appveyor.yml create mode 100644 appveyor.yml.template create mode 100755 test-build.ps1 create mode 100644 test-image.ps1 diff --git a/travis.yml.template b/.travis.yml.template similarity index 100% rename from travis.yml.template rename to .travis.yml.template diff --git a/10/windows/nanoserver/Dockerfile b/10/windows/nanoserver/Dockerfile new file mode 100644 index 000000000..9ead2b562 --- /dev/null +++ b/10/windows/nanoserver/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 10.4.0 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.7.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 10.4.0 +ENV YARN_VERSION 1.7.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH + +CMD [ "node.exe" ] diff --git a/10/windows/windowsservercore/Dockerfile b/10/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..7d2e70c06 --- /dev/null +++ b/10/windows/windowsservercore/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 10.4.0 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.7.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 10.4.0 +ENV YARN_VERSION 1.7.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + +CMD [ "node.exe" ] diff --git a/6/windows/nanoserver/Dockerfile b/6/windows/nanoserver/Dockerfile new file mode 100644 index 000000000..c3226f6e4 --- /dev/null +++ b/6/windows/nanoserver/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 6.14.2 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.6.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 6.14.2 +ENV YARN_VERSION 1.6.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH + +CMD [ "node.exe" ] diff --git a/6/windows/windowsservercore/Dockerfile b/6/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..fd155952d --- /dev/null +++ b/6/windows/windowsservercore/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 6.14.2 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.6.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 6.14.2 +ENV YARN_VERSION 1.6.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + +CMD [ "node.exe" ] diff --git a/8/windows/nanoserver/Dockerfile b/8/windows/nanoserver/Dockerfile new file mode 100644 index 000000000..04e196219 --- /dev/null +++ b/8/windows/nanoserver/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 8.11.2 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.6.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 8.11.2 +ENV YARN_VERSION 1.6.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH + +CMD [ "node.exe" ] diff --git a/8/windows/windowsservercore/Dockerfile b/8/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..a901fe55f --- /dev/null +++ b/8/windows/windowsservercore/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 8.11.2 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.6.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 8.11.2 +ENV YARN_VERSION 1.6.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + +CMD [ "node.exe" ] diff --git a/9/windows/nanoserver/Dockerfile b/9/windows/nanoserver/Dockerfile new file mode 100644 index 000000000..cf93d126a --- /dev/null +++ b/9/windows/nanoserver/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 9.11.1 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.5.1 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 9.11.1 +ENV YARN_VERSION 1.5.1 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH + +CMD [ "node.exe" ] diff --git a/9/windows/windowsservercore/Dockerfile b/9/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..95128a005 --- /dev/null +++ b/9/windows/windowsservercore/Dockerfile @@ -0,0 +1,60 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 9.11.1 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 1.5.1 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 9.11.1 +ENV YARN_VERSION 1.5.1 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + +CMD [ "node.exe" ] diff --git a/Dockerfile-nanoserver.template b/Dockerfile-nanoserver.template new file mode 100644 index 000000000..d03d6cb0f --- /dev/null +++ b/Dockerfile-nanoserver.template @@ -0,0 +1,52 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 0.0.0 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + "${NODE_KEYS[@]}" + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 0.0.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 0.0.0 +ENV YARN_VERSION 0.0.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH + +CMD [ "node.exe" ] diff --git a/Dockerfile-windowsservercore.template b/Dockerfile-windowsservercore.template new file mode 100644 index 000000000..8ea8b5f17 --- /dev/null +++ b/Dockerfile-windowsservercore.template @@ -0,0 +1,52 @@ +FROM microsoft/windowsservercore as download + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 0.0.0 + +ENV GPG_VERSION 2.3.4 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; + +RUN @( \ + "${NODE_KEYS[@]}" + ) | foreach { \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ + } ; \ + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' + +ENV YARN_VERSION 0.0.0 + +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ + if (@( \ + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NODE_VERSION 0.0.0 +ENV YARN_VERSION 0.0.0 + +COPY --from=download /nodejs /nodejs +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] + +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) + +CMD [ "node.exe" ] diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..b4c9e3dad --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,57 @@ +#### DO NOT MODIFY. THIS FILE IS AUTOGENERATED #### + +version: 1.0.{build} +image: Visual Studio 2017 + +build_script: + - ps: .\test-build.ps1 $env:NODE_VERSION $env:VARIANT + +for: + - + matrix: + only: + - STAGE: "Test" + install: + - ps: Install-PackageProvider -Name NuGet -Force + - ps: Install-Module PsScriptAnalyzer -Force + build_script: + - ps: Invoke-ScriptAnalyzer -Path './' + +environment: + matrix: + - + STAGE: "Test" + + # Docker Build # + + - + NODE_VERSION: "10" + VARIANT: "windowsservercore" + + - + NODE_VERSION: "10" + VARIANT: "nanoserver" + + - + NODE_VERSION: "6" + VARIANT: "windowsservercore" + + - + NODE_VERSION: "6" + VARIANT: "nanoserver" + + - + NODE_VERSION: "8" + VARIANT: "windowsservercore" + + - + NODE_VERSION: "8" + VARIANT: "nanoserver" + + - + NODE_VERSION: "9" + VARIANT: "windowsservercore" + + - + NODE_VERSION: "9" + VARIANT: "nanoserver" diff --git a/appveyor.yml.template b/appveyor.yml.template new file mode 100644 index 000000000..8b5aa1d60 --- /dev/null +++ b/appveyor.yml.template @@ -0,0 +1,23 @@ +version: 1.0.{build} +image: Visual Studio 2017 + +build_script: + - ps: .\test-build.ps1 $env:NODE_VERSION $env:VARIANT + +for: + - + matrix: + only: + - STAGE: "Test" + install: + - ps: Install-PackageProvider -Name NuGet -Force + - ps: Install-Module PsScriptAnalyzer -Force + build_script: + - ps: Invoke-ScriptAnalyzer -Path './' + +environment: + matrix: + - + STAGE: "Test" + + # Docker Build # diff --git a/architectures b/architectures index 1a9b7a2dd..49e6ca611 100644 --- a/architectures +++ b/architectures @@ -6,3 +6,4 @@ amd64 jessie,alpine,onbuild,slim,stretch i386 jessie,alpine,onbuild,slim,stretch ppc64le jessie,alpine,onbuild,slim,stretch s390x jessie,alpine,onbuild,slim,stretch +windows-amd64 windowsservercore,nanoserver diff --git a/config b/config index 20c552259..1379d47b1 100644 --- a/config +++ b/config @@ -1,3 +1,4 @@ baseuri https://nodejs.org/dist default_variant jessie +default_windows_variant windowsservercore alpine_version 3.7 diff --git a/functions.sh b/functions.sh index 24d17aa36..2f4f4858a 100755 --- a/functions.sh +++ b/functions.sh @@ -54,13 +54,14 @@ function get_variants() { local dir dir=${1:-.} shift - local arch + arch=${1:-$(get_arch)} + shift + local availablevariants local variantsfilter local variants=() - arch=$(get_arch) variantsfilter=("$@") IFS=' ' read -ra availablevariants <<<"$(grep "^${arch}" "${dir}/architectures" | sed -E 's/'"${arch}"'[[:space:]]*//' | sed -E 's/,/ /g')" @@ -81,6 +82,19 @@ function get_variants() { fi } +# Get corresponding variants based on the architecture. +# All supported variants of each supported architecutre are listed in a +# file - 'architectures'. Its format is: +# ,... +# ,... +function get_windows_variants() { + local dir + dir=${1:-.} + shift + + get_variants "${dir}" "windows-$(get_arch)" $@ +} + # Get supported architectures for a specific version and variant # # Get default supported architectures from 'architectures'. Then go to the version folder diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index e2ac5b393..b823ebdd2 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -106,4 +106,25 @@ for version in "${versions[@]}"; do echo "Directory: ${version}/${variant}" echo done + + IFS=' ' read -ra variants <<<"$(get_windows_variants "$(dirname "$version")")" + for variant in $variants; do + # Skip non-docker directories + [ -f "${version}/windows/${variant}/Dockerfile" ] || continue + + commit="$(fileCommit "${version}/windows/${variant}")" + + slash='/' + variantAliases=("${versionAliases[@]/%/-${variant//$slash/-}}") + variantAliases=("${variantAliases[@]//latest-/}") + # Get supported architectures for a specific version and variant. + # See details in function.sh + supportedArches=("$(get_supported_arches "${version}" "${variant}")") + + echo "Tags: $(join ', ' "${variantAliases[@]}")" + echo "Architectures: $(join ', ' "${supportedArches[@]}")" + echo "GitCommit: ${commit}" + echo "Directory: ${version}/windows/${variant}" + echo + done done diff --git a/test-build.ps1 b/test-build.ps1 new file mode 100755 index 000000000..93e5ff973 --- /dev/null +++ b/test-build.ps1 @@ -0,0 +1,68 @@ +param ([String[]] $versionsArg, [String[]] $variantsArg) +# Allow comma delimited cli arguments to filter versions and variants +# E.g. .\test-build.ps1 8,10 windowsservercore,nanoserver + +$ErrorActionPreference = 'Stop' + +$defaultWindowsVariant=((Get-Content config | Select-String -Pattern 'default_windows_variant') -split ' ')[1] + +Function Get-Version { + $versions = Get-ChildItem -name -directory | Where-Object { ($_ -ne ".git") -and ($_ -ne "docs") -and ($_ -ne "keys") -and ($_ -notcontains "chakracore") } + + If ($versionsArg) { + $filteredVersions = @() + + ForEach ($version in $versionsArg) { + If ($versions.Contains($version)) { + $filteredVersions += $version + } + } + + If ($filteredVersions.length -gt 0) { + return $filteredVersions + } + } + return $versions +} + +Function Get-Variant { + $variants=(((Get-Content architectures | Select-String -Pattern 'windows-amd64') -split ' ')[1] -split ',') + + if ($variantsArg) { + $filteredVariants = @() + + ForEach ($variant in $variantsArg) { + If ($variants.Contains($variant)) { + $filteredVariants += $variant + } + } + + If ($filteredVariants.length -gt 0) { + return $filteredVariants + } + } + return $variants +} + +Function Build { + param ( $version, $variant, $tag ) + + $full_tag="$tag-$variant" + + Write-Output "Building node:$full_tag" + docker build -t node:$full_tag $version/windows/$variant + if ( $? -eq $FALSE ) { + Write-Error "Build of $full_tag failed!" + } + Write-Output "Testing of $full_tag" + $path = (Get-Location).path.replace('\', '/') + docker run --rm -v "$path/:C:/docker-node/" node:"$full_tag" powershell "C:\docker-node\test-image.ps1" "$tag" +} + +ForEach ($Dir in Get-Version) { + $tag = ((Get-Content $Dir\windows\$defaultWindowsVariant\Dockerfile | Select-String -Pattern 'ENV NODE_VERSION') -split ' ')[2] + + ForEach ($variant in Get-Variant) { + Build $Dir $variant $tag + } +} diff --git a/test-build.sh b/test-build.sh index 61861e9e0..9ae91155a 100755 --- a/test-build.sh +++ b/test-build.sh @@ -70,7 +70,7 @@ for version in "${versions[@]}"; do # Get supported variants according to the target architecture. # See details in function.sh - IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")" "${variant_arg[@]}")" + IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")" $(get_arch) "${variant_arg[@]}")" for variant in "${variants[@]}"; do # Skip non-docker directories diff --git a/test-image.ps1 b/test-image.ps1 new file mode 100644 index 000000000..e5078cdc6 --- /dev/null +++ b/test-image.ps1 @@ -0,0 +1,18 @@ +Param($node_version) + +If ("$(node -e "process.stdout.write(process.versions.node)")" -ne "$node_version") { + Write-Error "Test for node failed!" +} +Write-Output "Test for node succeeded." + +npm --version *>$null +If (!$?) { + Write-Error "Test for npm failed!" +} +Write-Output "Test for npm succeeded." + +yarn --version *>$null +If (!$?) { + Write-Error "Test for yarn failed!" +} +Write-Output "Test for yarn succeeded." diff --git a/update.sh b/update.sh index 013293a08..037a2e571 100755 --- a/update.sh +++ b/update.sh @@ -48,7 +48,7 @@ cd "$(cd "${0%/*}" && pwd -P)" IFS=' ' read -ra versions <<<"$(get_versions .)" IFS=' ' read -ra update_versions <<<"$(get_versions . "${1-}")" -IFS=' ' read -ra update_variants <<<"$(get_variants . "${2-}")" +IFS=' ' read -ra update_variants <<<"$(get_variants . $(get_arch) "${2-}") $(get_variants . windows-$(get_arch) "${2-}")" if [ ${#versions[@]} -eq 0 ]; then fatal "No valid versions found!" fi @@ -145,9 +145,18 @@ function update_node_version() { # Add GPG keys for key_type in "node" "yarn"; do while read -r line; do + key="$line" pattern='"\$\{'$(echo "${key_type}" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"' - sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}-tmp" + + if [[ "$variant" == "" ]] || [[ ! "$(get_windows_variants)" =~ $variant ]]; then + replacement="\\1${key}${new_line}\\1\\2" + else + replacement="\\1'${key}',${new_line}\\1\\2" + fi + + sed -Ei -e "s/([ \\t]*)($pattern)/${replacement}/" "${dockerfile}-tmp" done <"keys/${key_type}.keys" + sed -Ei -e "s/'${key}',/'${key}'/" "${dockerfile}-tmp" sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp" done @@ -167,9 +176,7 @@ function update_node_version() { ) } -function add_stage() { - local baseuri=${1} - shift +function add_travis_stage() { local version=${1} shift local variant=${1} @@ -182,8 +189,23 @@ function add_stage() { - VARIANT: "'"${variant}"'"' >>.travis.yml } +function add_appveyor_stage() { + local version=${1} + shift + local variant=${1} + shift + + echo ' + - + NODE_VERSION: "'"${version}"'" + VARIANT: "'"${variant}"'"' >>appveyor.yml +} + echo '#### DO NOT MODIFY. THIS FILE IS AUTOGENERATED #### -' | cat - travis.yml.template >.travis.yml +' | cat - .travis.yml.template >.travis.yml + +echo '#### DO NOT MODIFY. THIS FILE IS AUTOGENERATED #### +' | cat - appveyor.yml.template >appveyor.yml for version in "${versions[@]}"; do parentpath=$(dirname "${version}") @@ -198,7 +220,7 @@ for version in "${versions[@]}"; do IFS=' ' read -ra variants <<<"$(get_variants "${parentpath}")" if [ -f "${version}/Dockerfile" ]; then - add_stage "${baseuri}" "${version}" "default" + add_travis_stage "${version}" "default" if [ "${update_version}" -eq 0 ]; then update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" & @@ -208,7 +230,7 @@ for version in "${versions[@]}"; do for variant in "${variants[@]}"; do # Skip non-docker directories [ -f "${version}/${variant}/Dockerfile" ] || continue - add_stage "${baseuri}" "${version}" "${variant}" + add_travis_stage "${version}" "${variant}" update_variant=$(in_variants_to_update "${variant}") @@ -216,6 +238,19 @@ for version in "${versions[@]}"; do update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile-${variant}.template" "${version}/${variant}/Dockerfile" "${variant}" & fi done + + IFS=' ' read -ra windows_variants <<<"$(get_windows_variants "$parentpath")" + if [ ${#windows_variants[@]} -gt 0 ]; then + for variant in "${windows_variants[@]}"; do + add_appveyor_stage "${version}" "${variant}" + + update_variant=$(in_variants_to_update "${variant}") + + if [ "${update_version}" -eq 0 ] && [ "${update_variant}" -eq 0 ]; then + update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile-${variant}.template" "${version}/windows/${variant}/Dockerfile" "${variant}" & + fi + done + fi done wait From ee336b4f2fc3cf7d3b72908b20153507e081bb2a Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Tue, 12 Jun 2018 11:47:17 -0400 Subject: [PATCH 4/4] test --- 10/windows/nanoserver/Dockerfile | 19 ++++--------------- 10/windows/windowsservercore/Dockerfile | 12 +----------- 6/windows/nanoserver/Dockerfile | 21 +++++---------------- 6/windows/windowsservercore/Dockerfile | 12 +----------- 8/windows/nanoserver/Dockerfile | 19 ++++--------------- 8/windows/windowsservercore/Dockerfile | 12 +----------- 9/windows/nanoserver/Dockerfile | 19 ++++--------------- 9/windows/windowsservercore/Dockerfile | 12 +----------- Dockerfile-nanoserver.template | 19 ++++--------------- Dockerfile-windowsservercore.template | 12 +----------- test.sh | 8 ++++++++ 11 files changed, 34 insertions(+), 131 deletions(-) create mode 100755 test.sh diff --git a/10/windows/nanoserver/Dockerfile b/10/windows/nanoserver/Dockerfile index 9ead2b562..e448c9e8c 100644 --- a/10/windows/nanoserver/Dockerfile +++ b/10/windows/nanoserver/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -6,8 +6,7 @@ ENV NODE_VERSION 10.4.0 ENV GPG_VERSION 2.3.4 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ - Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ +RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; RUN @( \ @@ -23,7 +22,7 @@ RUN @( \ ) | foreach { \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ } ; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ @@ -34,7 +33,7 @@ RUN @( \ ENV YARN_VERSION 1.7.0 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ @@ -43,16 +42,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/nanoserver - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 10.4.0 -ENV YARN_VERSION 1.7.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH diff --git a/10/windows/windowsservercore/Dockerfile b/10/windows/windowsservercore/Dockerfile index 7d2e70c06..681b64ed1 100644 --- a/10/windows/windowsservercore/Dockerfile +++ b/10/windows/windowsservercore/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -43,16 +43,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/windowsservercore - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 10.4.0 -ENV YARN_VERSION 1.7.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) diff --git a/6/windows/nanoserver/Dockerfile b/6/windows/nanoserver/Dockerfile index c3226f6e4..7da77dc26 100644 --- a/6/windows/nanoserver/Dockerfile +++ b/6/windows/nanoserver/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -6,8 +6,7 @@ ENV NODE_VERSION 6.14.2 ENV GPG_VERSION 2.3.4 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ - Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ +RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; RUN @( \ @@ -23,7 +22,7 @@ RUN @( \ ) | foreach { \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ } ; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ @@ -32,9 +31,9 @@ RUN @( \ Expand-Archive node.zip -DestinationPath C:\ ; \ Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' -ENV YARN_VERSION 1.6.0 +ENV YARN_VERSION 1.7.0 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ @@ -43,16 +42,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/nanoserver - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 6.14.2 -ENV YARN_VERSION 1.6.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH diff --git a/6/windows/windowsservercore/Dockerfile b/6/windows/windowsservercore/Dockerfile index fd155952d..ad23e7ad3 100644 --- a/6/windows/windowsservercore/Dockerfile +++ b/6/windows/windowsservercore/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -43,16 +43,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/windowsservercore - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 6.14.2 -ENV YARN_VERSION 1.6.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) diff --git a/8/windows/nanoserver/Dockerfile b/8/windows/nanoserver/Dockerfile index 04e196219..f6b5d4a53 100644 --- a/8/windows/nanoserver/Dockerfile +++ b/8/windows/nanoserver/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -6,8 +6,7 @@ ENV NODE_VERSION 8.11.2 ENV GPG_VERSION 2.3.4 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ - Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ +RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; RUN @( \ @@ -23,7 +22,7 @@ RUN @( \ ) | foreach { \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ } ; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ @@ -34,7 +33,7 @@ RUN @( \ ENV YARN_VERSION 1.6.0 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ @@ -43,16 +42,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/nanoserver - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 8.11.2 -ENV YARN_VERSION 1.6.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH diff --git a/8/windows/windowsservercore/Dockerfile b/8/windows/windowsservercore/Dockerfile index a901fe55f..576722de2 100644 --- a/8/windows/windowsservercore/Dockerfile +++ b/8/windows/windowsservercore/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -43,16 +43,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/windowsservercore - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 8.11.2 -ENV YARN_VERSION 1.6.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) diff --git a/9/windows/nanoserver/Dockerfile b/9/windows/nanoserver/Dockerfile index cf93d126a..5d78917c0 100644 --- a/9/windows/nanoserver/Dockerfile +++ b/9/windows/nanoserver/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -6,8 +6,7 @@ ENV NODE_VERSION 9.11.1 ENV GPG_VERSION 2.3.4 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ - Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ +RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; RUN @( \ @@ -23,7 +22,7 @@ RUN @( \ ) | foreach { \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ } ; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ @@ -34,7 +33,7 @@ RUN @( \ ENV YARN_VERSION 1.5.1 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ @@ -43,16 +42,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/nanoserver - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 9.11.1 -ENV YARN_VERSION 1.5.1 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH diff --git a/9/windows/windowsservercore/Dockerfile b/9/windows/windowsservercore/Dockerfile index 95128a005..f1ef95d4c 100644 --- a/9/windows/windowsservercore/Dockerfile +++ b/9/windows/windowsservercore/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -43,16 +43,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/windowsservercore - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 9.11.1 -ENV YARN_VERSION 1.5.1 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) diff --git a/Dockerfile-nanoserver.template b/Dockerfile-nanoserver.template index d03d6cb0f..95c11ba37 100644 --- a/Dockerfile-nanoserver.template +++ b/Dockerfile-nanoserver.template @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/nanoserver SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -6,8 +6,7 @@ ENV NODE_VERSION 0.0.0 ENV GPG_VERSION 2.3.4 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ - Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ +RUN Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; RUN @( \ @@ -15,7 +14,7 @@ RUN @( \ ) | foreach { \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ } ; \ - [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ @@ -26,7 +25,7 @@ RUN @( \ ENV YARN_VERSION 0.0.0 -RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ @@ -35,16 +34,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/nanoserver - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 0.0.0 -ENV YARN_VERSION 0.0.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH diff --git a/Dockerfile-windowsservercore.template b/Dockerfile-windowsservercore.template index 8ea8b5f17..83bf87bdc 100644 --- a/Dockerfile-windowsservercore.template +++ b/Dockerfile-windowsservercore.template @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore as download +FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] @@ -35,16 +35,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityPro ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait -FROM microsoft/windowsservercore - -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -ENV NODE_VERSION 0.0.0 -ENV YARN_VERSION 0.0.0 - -COPY --from=download /nodejs /nodejs -COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] - RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) diff --git a/test.sh b/test.sh new file mode 100755 index 000000000..c7872fd5e --- /dev/null +++ b/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +. functions.sh + +images_updated "947280600648b70e067d35415d6812fd03127def" "35f1c9e977d23bd306212c73612f7bf55bc6d615" && echo "test" +images_updated "947280600648b70e067d35415d6812fd03127def..35f1c9e977d23bd306212c73612f7bf55bc6d615" && echo "test" +images_updated "947280600648b70e067d35415d6812fd03127def" && echo "test" +images_updated || echo "test" +images_updated "e5cebee5dbf9...4000fe6354dd" || echo "test"