Improve .NET Core containers, switch to MCR images

This commit is contained in:
Chuck Lantz 2019-04-12 11:52:46 -07:00
Родитель d1998aa5e1
Коммит ece7573fab
54 изменённых файлов: 440 добавлений и 26 удалений

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "Dev Container Editing",
"dockerFile": ".devcontainer/Dockerfile",
"dockerFile": "Dockerfile",
"extensions": [
"yzhang.markdown-all-in-one",
"streetsidesoftware.code-spell-checker",

Просмотреть файл

@ -0,0 +1,22 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y azure-cli azure-functions-core-tools
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,9 @@
{
"name": "Azure Functions & C# (.NET Core 2.1)",
"dockerFile": "Dockerfile",
"appPort": 7071,
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-vscode.csharp"
]
}

Просмотреть файл

@ -0,0 +1,23 @@
# Azure Functions & C# (.NET Core 2.1)
## Summary
*A basic dev container definition for building Node.js based Azure Functions in a container. Includes everything you need to get up and running.*
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code Team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Azure Functions, Node.js, JavaScript |
## Usage
[See here for information on using this definition with an existing project](../../README.md#using-a-definition).
If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](../../LICENSE).

Просмотреть файл

@ -0,0 +1,22 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/core/sdk:latest
# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y azure-cli azure-functions-core-tools
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,9 @@
{
"name": "Azure Functions & C# (.NET Core Latest)",
"dockerFile": "Dockerfile",
"appPort": 7071,
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-vscode.csharp"
]
}

Просмотреть файл

@ -0,0 +1,23 @@
# Azure Functions & C# (.NET Core Latest)
## Summary
*A basic dev container definition for building Node.js based Azure Functions in a container. Includes everything you need to get up and running.*
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code Team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Azure Functions, Node.js, JavaScript |
## Usage
[See here for information on using this definition with an existing project](../../README.md#using-a-definition).
If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](../../LICENSE).

Просмотреть файл

@ -3,7 +3,7 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM microsoft/dotnet:2.1-sdk-bionic
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
@ -18,13 +18,13 @@ RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh
# Install eslint
RUN /bin/bash -c "source $HOME/.nvm/nvm.sh && npm install -g eslint"
# Install Azure Functions
RUN apt-get install -y apt-transport-https \
&& curl -sSO https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y azure-functions-core-tools
&& apt-get install -y azure-cli azure-functions-core-tools
# Clean up
RUN apt-get autoremove -y \

Просмотреть файл

@ -1,4 +1,4 @@
# Azure Functions w/Node.js v8
# Azure Functions & Node.js 8
## Summary

Просмотреть файл

@ -3,7 +3,7 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM microsoft/dotnet:2.1-sdk-bionic
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
# Install git, process tools, bash
RUN apt-get update && apt-get -y install git procps
@ -18,14 +18,14 @@ RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh
# Install eslint
RUN /bin/bash -c "source $HOME/.nvm/nvm.sh && npm install -g eslint"
# Install Azure Functions
RUN apt-get install -y apt-transport-https \
&& curl -sSO https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
# Install Azure Functions and Azure CLI
RUN apt-get install -y apt-transport-https curl gnupg2 lsb-release \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \
&& curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y azure-functions-core-tools
&& apt-get install -y azure-cli azure-functions-core-tools
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \

Просмотреть файл

@ -1,4 +1,4 @@
# Azure Functions w/Node.js v8
# Azure Functions & Node.js (latest LTS)
## Summary

Просмотреть файл

@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------------------
# Pick any base image, but if you select node, skip installing node. 😊
FROM ubuntu:bionic
FROM debian:9
# Install git, required tools
RUN apt-get update \

Просмотреть файл

@ -2,8 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM microsoft/dotnet:2.2-sdk
FROM debian:9
# Install git, process tools
RUN apt-get update && apt-get -y install git procps
@ -12,3 +11,4 @@ RUN apt-get update && apt-get -y install git procps
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,5 @@
{
"name": "Debian 9 + Git",
"dockerFile": "Dockerfile",
"appPort": []
}

Просмотреть файл

@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore

Просмотреть файл

@ -0,0 +1,25 @@
# Ubuntu 18.04 + Git
## Summary
*A starter container definition with Ubuntu 18.04 and Git installed.*
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code Team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Any |
## Usage
[See here for information on using this definition with an existing project](../../README.md#using-a-definition).
If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.
If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. You can then start the test program from Debug panel in VS Code.
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](../../LICENSE).

Просмотреть файл

@ -3,7 +3,7 @@
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM microsoft/dotnet:2.2-sdk
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
# Copy endpoint specific user settings overrides into container to specify
# .NET Core should be used as the runtime.

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "F#",
"name": "F# (.NET Core 2.1)",
"dockerFile": "Dockerfile",
"extensions": [
"Ionide.Ionide-fsharp",

Просмотреть файл

@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,4 +1,4 @@
# F# (.NET Core 2.2)
# F# (.NET Core 2.1)
## Summary

Просмотреть файл

@ -0,0 +1,14 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
# Install git, process tools
RUN apt-get update && apt-get -y install git procps
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": ".NET Core 2.2",
"name": "C# (.NET Core 2.1)",
"dockerFile": "Dockerfile",
"appPort": 8090,
"extensions": [

Просмотреть файл

@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,4 +1,4 @@
# .NET Core 2.2
# C# (.NET Core 2.1)
## Summary

Просмотреть файл

@ -0,0 +1,22 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/core/sdk:latest
# Copy endpoint specific user settings overrides into container to specify
# .NET Core should be used as the runtime.
COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json
# Install git, process tools
RUN apt-get update && apt-get -y install git procps
# Install fsharp
RUN apt-get install -y fsharp
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,8 @@
{
"name": "F# (.NET Core Latest)",
"dockerFile": "Dockerfile",
"extensions": [
"Ionide.Ionide-fsharp",
"ms-vscode.csharp"
]
}

Просмотреть файл

@ -0,0 +1,3 @@
{
"FSharp.fsacRuntime":"netcore"
}

Просмотреть файл

@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore

26
containers/dotnetcore-latest-fsharp/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/test-project/bin/Debug/netcoreapp2.2/app.dll",
"args": [],
"cwd": "${workspaceFolder}/test-project",
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

3
containers/dotnetcore-latest-fsharp/.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"razor.disabled": true
}

17
containers/dotnetcore-latest-fsharp/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "cd test-project && dotnet build",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}

Просмотреть файл

@ -0,0 +1,25 @@
# F# (.NET Core Latest)
## Summary
*A basic dev container definition for using F# in a container. Includes everything you need to get up and running.*
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code Team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | F# |
## Usage
[See here for information on using this definition with an existing project](../../README.md#using-a-definition).
If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.
If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. You can then start the test program from Debug panel in VS Code.
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](../../LICENSE).

Просмотреть файл

@ -0,0 +1,15 @@
//----------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// ----------------------------------------------------------------------------------------
open System
[<EntryPoint>]
let main argv =
let from = "F# Container"
let target = "World"
let message = "Hello " + target + " from " + from + "!"
printfn "%s" message
0 // return an integer exit code

Просмотреть файл

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
<Reference Include="netstandard" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------
FROM mcr.microsoft.com/dotnet/core/sdk:latest
# Install git, process tools
RUN apt-get update && apt-get -y install git procps
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

Просмотреть файл

@ -0,0 +1,8 @@
{
"name": ".C# (.NET Core Latest)",
"dockerFile": "Dockerfile",
"appPort": 8090,
"extensions": [
"ms-vscode.csharp"
]
}

Просмотреть файл

@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore

16
containers/dotnetcore-latest/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"program": "dotnet",
"args": ["run"],
"cwd": "${workspaceFolder}/test-project",
}
]
}

3
containers/dotnetcore-latest/.vscode/settings.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"razor.disabled": true
}

Просмотреть файл

@ -0,0 +1,25 @@
# C# (.NET Core 2.1)
## Summary
*A basic dev container definition for developing .NET Core applications in a container. Includes everything you need to get up and running.*
| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code Team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | .NET Core |
## Usage
[See here for information on using this definition with an existing project](../../README.md#using-a-definition).
If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project.
If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. You can then start the test program from Debug panel in VS Code.
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See [LICENSE](../../LICENSE).

Просмотреть файл

@ -0,0 +1,32 @@
/*----------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*---------------------------------------------------------------------------------------*/
using System;
using System.Linq;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Http;
using System.IO;
namespace aspnetapp
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("http://0.0.0.0:8090")
.Configure(app => app.Run(async context => {
await context.Response.WriteAsync("Hello remote world from ASP.NET Core!");
}))
.Build();
host.Run();
}
}
}

Просмотреть файл

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>31051026529000467138</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>