Skip to content

Commit

Permalink
Add nanoserver-1809 container images using multi-stage builds (#470)
Browse files Browse the repository at this point in the history
* docker-mongo: add nanoserver-1809 container images using multi-stage builds

* Integrate nanoserver in templating

Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
  • Loading branch information
awakecoding and tianon authored May 17, 2021
1 parent b3edd5a commit dc35ba5
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 23 deletions.
32 changes: 32 additions & 0 deletions 4.0/windows/nanoserver-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.0/windows/windowsservercore-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.0/windows/windowsservercore-ltsc2016/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions 4.2/windows/nanoserver-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.2/windows/windowsservercore-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.2/windows/windowsservercore-ltsc2016/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions 4.4/windows/nanoserver-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.4/windows/windowsservercore-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.4/windows/windowsservercore-ltsc2016/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions 4.9-rc/windows/nanoserver-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.9-rc/windows/windowsservercore-1809/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 4.9-rc/windows/windowsservercore-ltsc2016/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 33 additions & 2 deletions Dockerfile-windows.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }}

{{ if env.windowsVariant == "servercore" then ( -}}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

{{ if .notes then ( -}}
Expand Down Expand Up @@ -58,9 +59,39 @@ RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
\
Write-Host 'Complete.';

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

# TODO docker-entrypoint.ps1 ? (for "docker run <image> --flag --flag --flag")
{{ ) else ( -}}
SHELL ["cmd", "/S", "/C"]

# PATH isn't actually set in the Docker image, so we have to set it from within the container
USER ContainerAdministrator
RUN setx /m PATH "C:\mongodb\bin;%PATH%"
USER ContainerUser
# doing this first to share cache across versions more aggressively

{{ def copy_from: "mongo:" + .version + "-windowsservercore-" + env.windowsRelease -}}
COPY --from={{ copy_from }} \
C:\\Windows\\System32\\msvcp140.dll \
C:\\Windows\\System32\\vcruntime140.dll \
{{ if [ "4.0", "4.2" ] | index(env.version) then "" else ( -}}
{{ # https://github.com/docker-library/mongo/pull/470#discussion_r633701963 -}}
C:\\Windows\\System32\\vcruntime140_1.dll \
{{ ) end -}}
C:\\Windows\\System32\\

{{ if .notes then ( -}}
# {{ .notes }}
{{ ) else "" end -}}
ENV MONGO_VERSION {{ .version }}
{{ if .date or .githash then ( -}}
# {{ [ .date // empty, "https://github.com/mongodb/mongo/tree/" + .githash // empty ] | join(", ") }}
{{ ) else "" end -}}

COPY --from={{ copy_from }} C:\\mongodb C:\\mongodb
RUN mongo --version && mongod --version
{{ ) end -}}

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

EXPOSE 27017
CMD ["mongod", "--bind_ip_all"]
12 changes: 8 additions & 4 deletions versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"sha256": "e17a25bc51b6bdcf6da0fe6b0ba22075b43566119c656b454542735133cd9f1e",
"variants": [
"windowsservercore-1809",
"windowsservercore-ltsc2016"
"windowsservercore-ltsc2016",
"nanoserver-1809"
]
}
},
Expand Down Expand Up @@ -94,7 +95,8 @@
"sha256": "706610f96ae74963d5348aafe34f976e7b1c02ef1a9f3596862e1e5ba3437e76",
"variants": [
"windowsservercore-1809",
"windowsservercore-ltsc2016"
"windowsservercore-ltsc2016",
"nanoserver-1809"
]
}
},
Expand Down Expand Up @@ -155,7 +157,8 @@
"sha256": "ede50e8f8d8c9d23a8ca2cc1c96cdb9bcc1f617930e8bd1d46f21d95d0b555f8",
"variants": [
"windowsservercore-1809",
"windowsservercore-ltsc2016"
"windowsservercore-ltsc2016",
"nanoserver-1809"
]
}
},
Expand Down Expand Up @@ -210,7 +213,8 @@
"sha256": "67c8bf03590c7ecbaf793db559f7f7fea44eb0481a2c4e486756ee4ea9ed575c",
"variants": [
"windowsservercore-1809",
"windowsservercore-ltsc2016"
"windowsservercore-ltsc2016",
"nanoserver-1809"
]
}
},
Expand Down
3 changes: 2 additions & 1 deletion versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ for version in "${versions[@]}"; do
sha256: env.msiSha256,
variants: [
"windowsservercore-1809",
"windowsservercore-ltsc2016"
"windowsservercore-ltsc2016",
"nanoserver-1809"
],
features: ([
# https://github.com/mongodb/mongo/blob/r4.4.2/src/mongo/installer/msi/wxs/FeatureFragment.wxs#L9-L92 (no MonitoringTools,ImportExportTools)
Expand Down

0 comments on commit dc35ba5

Please sign in to comment.