Skip to content

Commit

Permalink
Adding 2.0.0-preview2 Dockerfiles (#260)
Browse files Browse the repository at this point in the history
* Adding 2.0.0-preview2 Dockerfiles

* Add stretch Dockerfiles
  • Loading branch information
MichaelSimons authored Jun 27, 2017
1 parent 0b02ac8 commit 5718313
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 94 deletions.
19 changes: 19 additions & 0 deletions 2.0/runtime-deps/stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:stretch

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
\
# .NET Core dependencies
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu57 \
liblttng-ust0 \
libssl1.0.2 \
libstdc++6 \
libunwind8 \
libuuid1 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
8 changes: 5 additions & 3 deletions 2.0/runtime/jessie/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM microsoft/dotnet:2.0-runtime-deps
FROM microsoft/dotnet:2.0-runtime-deps-jessie

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install .NET Core
ENV DOTNET_VERSION 2.0.0-preview1-002111-00
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/release/2.0.0/Binaries/$DOTNET_VERSION/dotnet-linux-x64.$DOTNET_VERSION-portable.tar.gz
ENV DOTNET_VERSION 2.0.0-preview2-25407-01
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-linux-x64.tar.gz
ENV DOTNET_DOWNLOAD_SHA 72AA9ABAE8BC818EEB742AFFB943D6AF33B009F84696E6DE7C5316B8975FCC9B4303CB0B80652727BB1FFEE1A025E0C7A43CFE1771D11FE6DEE2D36B002A7EDC

RUN curl -SL $DOTNET_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
Expand Down
10 changes: 8 additions & 2 deletions 2.0/runtime/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ FROM microsoft/nanoserver:10.0.14393.1358
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install .NET Core
ENV DOTNET_VERSION 2.0.0-preview1-002111-00
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/release/2.0.0/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION-portable.zip
ENV DOTNET_VERSION 2.0.0-preview2-25407-01
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-win-x64.zip
ENV DOTNET_DOWNLOAD_SHA 234F702025C292C6A432F2F93439294EE164F294485343027B952CEA2085B871064A92E6AED335DA7E05FCEA99AC303E81B750021D7782ACECA867F6D789F3DC

RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; \
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_DOWNLOAD_SHA) { \
Write-Host 'CHECKSUM VERIFICATION FAILED!'; \
exit 1; \
}; \
\
Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet; \
Remove-Item -Force dotnet.zip

Expand Down
18 changes: 18 additions & 0 deletions 2.0/runtime/stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM microsoft/dotnet:2.0-runtime-deps

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

# Install .NET Core
ENV DOTNET_VERSION 2.0.0-preview2-25407-01
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-linux-x64.tar.gz
ENV DOTNET_DOWNLOAD_SHA 72AA9ABAE8BC818EEB742AFFB943D6AF33B009F84696E6DE7C5316B8975FCC9B4303CB0B80652727BB1FFEE1A025E0C7A43CFE1771D11FE6DEE2D36B002A7EDC

RUN curl -SL $DOTNET_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
6 changes: 4 additions & 2 deletions 2.0/sdk/jessie/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.0.0-preview1-005977
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-linux-x64.$DOTNET_SDK_VERSION.tar.gz
ENV DOTNET_SDK_VERSION 2.0.0-preview2-006497
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz
ENV DOTNET_SDK_DOWNLOAD_SHA 0664FE726EB07650D9C036B0E5E6D33AA8B10DB89DADA4A5E85FB5757FD1FAE1570AF0D526484014976761C829B1E55A70EF9966EECE877A56C2C426090896EB

RUN curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_SDK_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
Expand Down
10 changes: 8 additions & 2 deletions 2.0/sdk/nanoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ FROM microsoft/nanoserver:10.0.14393.1358
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.0.0-preview1-005977
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-win-x64.$DOTNET_SDK_VERSION.zip
ENV DOTNET_SDK_VERSION 2.0.0-preview2-006497
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-win-x64.zip
ENV DOTNET_SDK_DOWNLOAD_SHA 176F0E743BAEA13359F744C6BA443C7D64397800E71B8119185FAA68252CB1EECFF964D1E5E2D44408EEDE94A9EC6D8AC160117B210388FC750CD04CBE786C07

RUN Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; \
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_SDK_DOWNLOAD_SHA) { \
Write-Host 'CHECKSUM VERIFICATION FAILED!'; \
exit 1; \
}; \
\
Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet; \
Remove-Item -Force dotnet.zip

Expand Down
38 changes: 38 additions & 0 deletions 2.0/sdk/stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM buildpack-deps:stretch-scm

# Install .NET CLI dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu57 \
liblttng-ust0 \
libssl1.0.2 \
libstdc++6 \
libunwind8 \
libuuid1 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*

# Install .NET Core SDK
ENV DOTNET_SDK_VERSION 2.0.0-preview2-006497
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz
ENV DOTNET_SDK_DOWNLOAD_SHA 0664FE726EB07650D9C036B0E5E6D33AA8B10DB89DADA4A5E85FB5757FD1FAE1570AF0D526484014976761C829B1E55A70EF9966EECE877A56C2C426090896EB

RUN curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_SDK_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

# Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
RUN mkdir warmup \
&& cd warmup \
&& dotnet new \
&& cd .. \
&& rm -rf warmup \
&& rm -rf /tmp/NuGetScratch
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 .NET Foundation
Copyright (c) 2016 .NET Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
- `1.1.2-sdk`, `1.1-sdk`, `1-sdk`, `sdk`, `latest`:
- [`1.1.2-sdk-jessie` (*1.1/sdk/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/1.1/sdk/jessie/Dockerfile)
- [`1.1.2-sdk-nanoserver` (*1.1/sdk/nanoserver/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/1.1/sdk/nanoserver/Dockerfile)
- `2.0.0-preview1-runtime`, `2.0-runtime`, `2-runtime`:
- [`2.0.0-preview1-runtime-jessie` (*2.0/runtime/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime/jessie/Dockerfile)
- [`2.0.0-preview1-runtime-nanoserver` (*2.0/runtime/nanoserver/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime/nanoserver/Dockerfile)
- `2.0.0-preview1-runtime-deps`, `2.0-runtime-deps`, `2-runtime-deps`:
- [`2.0.0-preview1-runtime-deps-jessie` (*2.0/runtime-deps/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime-deps/jessie/Dockerfile)
- `2.0.0-preview1-sdk`, `2.0-sdk`, `2-sdk`:
- [`2.0.0-preview1-sdk-jessie` (*2.0/sdk/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/jessie/Dockerfile)
- [`2.0.0-preview1-sdk-nanoserver` (*2.0/sdk/nanoserver/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/nanoserver/Dockerfile)
- `2.0.0-preview2-runtime`, `2.0-runtime`, `2-runtime`:
- [`2.0.0-preview2-runtime-stretch` (*2.0/runtime/stretch/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime/stretch/Dockerfile)
- [`2.0.0-preview2-runtime-nanoserver` (*2.0/runtime/nanoserver/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime/nanoserver/Dockerfile)
- [`2.0.0-preview2-runtime-jessie`, `2.0-runtime-jessie`, `2-runtime-jessie` (*2.0/runtime/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime/jessie/Dockerfile)
- `2.0.0-preview2-runtime-deps`, `2.0-runtime-deps`, `2-runtime-deps`:
- [`2.0.0-preview2-runtime-deps-stretch` (*2.0/runtime-deps/stretch/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime-deps/stretch/Dockerfile)
- [`2.0.0-preview2-runtime-deps-jessie`, `2.0-runtime-deps-jessie`, `2-runtime-deps-jessie` (*2.0/runtime-deps/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime-deps/jessie/Dockerfile)
- `2.0.0-preview2-sdk`, `2.0-sdk`, `2-sdk`:
- [`2.0.0-preview2-sdk-stretch` (*2.0/sdk/stretch/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/stretch/Dockerfile)
- [`2.0.0-preview2-sdk-nanoserver` (*2.0/sdk/nanoserver/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/nanoserver/Dockerfile)
- [`2.0.0-preview2-sdk-jessie`, `2.0-sdk-jessie`, `2-sdk-jessie` (*2.0/sdk/jessie/Dockerfile*)](https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/jessie/Dockerfile)

>**Note:** The latest tag no longer uses the project.json project format, but has now been updated to be csproj/MSBuild-based. If you do not wish to [migrate](https://docs.microsoft.com/en-us/dotnet/articles/core/preview3/tools/dotnet-migrate) your existing projects to MSBuild simply change your Dockerfile to use the `1.1.0-sdk-projectjson` or `1.1.0-sdk-projectjson-nanoserver` tag. Going forward, new .NET Core sdk images will be MSBuild-based.
Expand Down
62 changes: 29 additions & 33 deletions build-and-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,44 @@ param(
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

$dirSeparator = [IO.Path]::DirectorySeparatorChar
$dockerRepo = (Get-Content "manifest.json" | ConvertFrom-Json).Repos[0].Name

if ($UseImageCache) {
$optionalDockerBuildArgs = ""
}
else {
$optionalDockerBuildArgs = "--no-cache"
}

$manifest = Get-Content "manifest.json" | ConvertFrom-Json
$manifestRepo = $manifest.Repos[0]
$platform = docker version -f "{{ .Server.Os }}"

if ($platform -eq "windows") {
$imageOs = "nanoserver"
}
else {
$imageOs = "jessie"
}

pushd $PSScriptRoot

$tags = [System.Collections.ArrayList]@()
Get-ChildItem -Recurse -Filter Dockerfile |
where {$_.DirectoryName.TrimStart($PSScriptRoot) -like "*$dirSeparator$imageOs*"} |
# sort in descending order to ensure runtime-deps get built before runtime to satisfy dependency
Sort-Object {$_.DirectoryName} -Descending |
foreach {
$tag = "${dockerRepo}:" +
$_.DirectoryName.
Replace("$PSScriptRoot$dirSeparator", '').
Replace("$dirSeparator$imageOs", '').
Replace($dirSeparator, '-')
$tags.Add($tag) | Out-Null
Write-Host "--- Building $tag from $($_.DirectoryName) ---"
docker build $optionalDockerBuildArgs -t $tag $_.DirectoryName
if (-NOT $?) {
throw "Failed building $tag"
}
$builtTags = @()

$manifestRepo.Images |
ForEach-Object {
$images = $_
$_.Platforms |
Where-Object {[bool]($_.PSobject.Properties.name -match $platform)} |
ForEach-Object {
$dockerfilePath = $_.$platform.dockerfile
$tags = $_.$platform.Tags
if ([bool]($images.PSobject.Properties.name -match "sharedTags")) {
$tags += $images.sharedTags
}

$qualifiedTags = $tags | ForEach-Object {
$manifestRepo.Name + ':' + $_.Replace('$(nanoServerVersion)', $manifest.TagVariables.NanoServerVersion)
}
$formattedTags = $qualifiedTags -join ', '
Write-Host "--- Building $formattedTags from $dockerfilePath ---"
Invoke-Expression "docker build $optionalDockerBuildArgs -t $($qualifiedTags -join ' -t ') $dockerfilePath"
if ($LastExitCode -ne 0) {
throw "Failed building $formattedTags"
}

$builtTags += $formattedTags
}
}

popd

./test/run-test.ps1 -UseImageCache:$UseImageCache

Write-Host "Tags built and tested:`n$($tags | Out-String)"
Write-Host "Tags built and tested:`n$($builtTags | Out-String)"
62 changes: 49 additions & 13 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,37 +169,37 @@
},
{
"sharedTags": [
"2.0.0-preview1-runtime-deps",
"2.0.0-preview2-runtime-deps",
"2.0-runtime-deps",
"2-runtime-deps"
],
"platforms": {
"linux": {
"dockerfile": "2.0/runtime-deps/jessie",
"dockerfile": "2.0/runtime-deps/stretch",
"tags": [
"2.0.0-preview1-runtime-deps-jessie"
"2.0.0-preview2-runtime-deps-stretch"
]
}
}
},
{
"sharedTags": [
"2.0.0-preview1-runtime",
"2.0.0-preview2-runtime",
"2.0-runtime",
"2-runtime"
],
"platforms": {
"linux": {
"dockerfile": "2.0/runtime/jessie",
"dockerfile": "2.0/runtime/stretch",
"tags": [
"2.0.0-preview1-runtime-jessie"
"2.0.0-preview2-runtime-stretch"
]
},
"windows": {
"dockerfile": "2.0/runtime/nanoserver",
"tags": [
"2.0.0-preview1-runtime-nanoserver",
"2.0.0-preview1-runtime-nanoserver-$(nanoServerVersion)",
"2.0.0-preview2-runtime-nanoserver",
"2.0.0-preview2-runtime-nanoserver-$(nanoServerVersion)",
"2.0-runtime-nanoserver",
"2.0-runtime-nanoserver-$(nanoServerVersion)",
"2-runtime-nanoserver",
Expand All @@ -210,29 +210,65 @@
},
{
"sharedTags": [
"2.0.0-preview1-sdk",
"2.0.0-preview2-sdk",
"2.0-sdk",
"2-sdk"
],
"platforms": {
"linux": {
"dockerfile": "2.0/sdk/jessie",
"dockerfile": "2.0/sdk/stretch",
"tags": [
"2.0.0-preview1-sdk-jessie"
"2.0.0-preview2-sdk-stretch"
]
},
"windows": {
"dockerfile": "2.0/sdk/nanoserver",
"tags": [
"2.0.0-preview1-sdk-nanoserver",
"2.0.0-preview1-sdk-nanoserver-$(nanoServerVersion)",
"2.0.0-preview2-sdk-nanoserver",
"2.0.0-preview2-sdk-nanoserver-$(nanoServerVersion)",
"2.0-sdk-nanoserver",
"2.0-sdk-nanoserver-$(nanoServerVersion)",
"2-sdk-nanoserver",
"2-sdk-nanoserver-$(nanoServerVersion)"
]
}
}
},
{
"platforms": {
"linux": {
"dockerfile": "2.0/runtime-deps/jessie",
"tags": [
"2.0.0-preview2-runtime-deps-jessie",
"2.0-runtime-deps-jessie",
"2-runtime-deps-jessie"
]
}
}
},
{
"platforms": {
"linux": {
"dockerfile": "2.0/runtime/jessie",
"tags": [
"2.0.0-preview2-runtime-jessie",
"2.0-runtime-jessie",
"2-runtime-jessie"
]
}
}
},
{
"platforms": {
"linux": {
"dockerfile": "2.0/sdk/jessie",
"tags": [
"2.0.0-preview2-sdk-jessie",
"2.0-sdk-jessie",
"2-sdk-jessie"
]
}
}
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ FROM {image}

WORKDIR test
RUN dotnet new {dotnetNewParam}
RUN dotnet restore
RUN dotnet restore {optionalRestoreParams}
RUN dotnet build
Loading

0 comments on commit 5718313

Please sign in to comment.