Skip to content

Commit

Permalink
Merge pull request docker-library#376 from infosiftr/1809
Browse files Browse the repository at this point in the history
Add Windows Server Core 1809
  • Loading branch information
tianon committed Dec 3, 2019
2 parents ae499b5 + 9ba0d6f commit 555063a
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 3 deletions.
49 changes: 49 additions & 0 deletions 4.0/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM microsoft/windowsservercore:1809

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

ENV MONGO_VERSION 4.0.13
ENV MONGO_DOWNLOAD_URL https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.13-signed.msi
ENV MONGO_DOWNLOAD_SHA256 3d81d6214017e66343be94109aa36147a684be43b2731c37e52dd14518501ec0

RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
(New-Object System.Net.WebClient).DownloadFile($env:MONGO_DOWNLOAD_URL, 'mongo.msi'); \
\
Write-Host ('Verifying sha256 ({0}) ...' -f $env:MONGO_DOWNLOAD_SHA256); \
if ((Get-FileHash mongo.msi -Algorithm sha256).Hash -ne $env:MONGO_DOWNLOAD_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Installing ...'; \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#install-mongodb-community-edition
Start-Process msiexec -Wait \
-ArgumentList @( \
'/i', \
'mongo.msi', \
'/quiet', \
'/qn', \
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
); \
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ...'; \
Write-Host ' mongo --version'; mongo --version; \
Write-Host ' mongod --version'; mongod --version; \
\
Write-Host 'Removing ...'; \
Remove-Item C:\mongodb\bin\*.pdb -Force; \
Remove-Item C:\windows\installer\*.msi -Force; \
Remove-Item mongo.msi -Force; \
\
Write-Host 'Complete.';

VOLUME C:\\data\\db C:\\data\\configdb

# TODO docker-entrypoint.ps1 ? (for "docker run <image> --flag --flag --flag")

EXPOSE 27017
CMD ["mongod", "--bind_ip_all"]
49 changes: 49 additions & 0 deletions 4.2/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM microsoft/windowsservercore:1809

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

ENV MONGO_VERSION 4.2.1
ENV MONGO_DOWNLOAD_URL https://downloads.mongodb.org/win32/mongodb-win32-x86_64-2012plus-4.2.1-signed.msi
ENV MONGO_DOWNLOAD_SHA256 0bd9f5361d21cf358156e8e18aae3f4bc0298e9949b4b988c4b15b52913f91d6

RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
(New-Object System.Net.WebClient).DownloadFile($env:MONGO_DOWNLOAD_URL, 'mongo.msi'); \
\
Write-Host ('Verifying sha256 ({0}) ...' -f $env:MONGO_DOWNLOAD_SHA256); \
if ((Get-FileHash mongo.msi -Algorithm sha256).Hash -ne $env:MONGO_DOWNLOAD_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Installing ...'; \
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#install-mongodb-community-edition
Start-Process msiexec -Wait \
-ArgumentList @( \
'/i', \
'mongo.msi', \
'/quiet', \
'/qn', \
'INSTALLLOCATION=C:\mongodb', \
'ADDLOCAL=all' \
); \
$env:PATH = 'C:\mongodb\bin;' + $env:PATH; \
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ...'; \
Write-Host ' mongo --version'; mongo --version; \
Write-Host ' mongod --version'; mongod --version; \
\
Write-Host 'Removing ...'; \
Remove-Item C:\mongodb\bin\*.pdb -Force; \
Remove-Item C:\windows\installer\*.msi -Force; \
Remove-Item mongo.msi -Force; \
\
Write-Host 'Complete.';

VOLUME C:\\data\\db C:\\data\\configdb

# TODO docker-entrypoint.ps1 ? (for "docker run <image> --flag --flag --flag")

EXPOSE 27017
CMD ["mongod", "--bind_ip_all"]
4 changes: 2 additions & 2 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ for version in "${versions[@]}"; do
EOE

for v in \
windows/windowsservercore-{ltsc2016,1803} \
windows/nanoserver-{sac2016,1803} \
windows/windowsservercore-{ltsc2016,1803,1809} \
windows/nanoserver-{sac2016,1803,1809} \
; do
dir="$version/$v"
variant="$(basename "$v")"
Expand Down
3 changes: 2 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ for version in "${versions[@]}"; do
echo "$version: $windowsVersion (windows)"

for winVariant in \
windowsservercore-{1803,ltsc2016} \
windowsservercore-{1809,1803,ltsc2016} \
; do
[ -d "$version/windows/$winVariant" ] || continue

Expand All @@ -151,6 +151,7 @@ for version in "${versions[@]}"; do

case "$winVariant" in
*-1803) travisEnv='\n - os: windows\n dist: 1803-containers\n env: VERSION='"$version VARIANT=windows/$winVariant$travisEnv" ;;
*-1809) ;; # no AppVeyor or Travis support for 1809: https://github.com/appveyor/ci/issues/1885
*) appveyorEnv='\n - version: '"$version"'\n variant: '"$winVariant$appveyorEnv" ;;
esac
done
Expand Down

0 comments on commit 555063a

Please sign in to comment.