mongo/Dockerfile for Windows Container at master · docker-library/mongo

Hits: 1123

FROM microsoft/windowsservercore

SHELL [“powershell”, “-Command”, “$ErrorActionPreference = ‘Stop’;”]

ENV MONGO_VERSION 3.4.4
ENV MONGO_DOWNLOAD_URL http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-${MONGO_VERSION}-signed.msi
ENV MONGO_DOWNLOAD_SHA256 73d1121a1fe58fe29c4fb7b6f4b79a4d33afa666f357960419ef83635396f977

RUN Write-Host (‘Downloading {0} …’ -f $env:MONGO_DOWNLOAD_URL); \
(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”]

 

Source: mongo/Dockerfile at master · docker-library/mongo

%d bloggers like this: