Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit a39c527

Browse files
authored
Merge pull request #156 from cartermp/fsharp-netcore-3.0
Add dotnetcore-3.0-fsharp
2 parents b582232 + 21ee06f commit a39c527

File tree

9 files changed

+208
-0
lines changed

9 files changed

+208
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
ARG DOTNETCORE_VESRION=3.0
7+
FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNETCORE_VESRION}
8+
9+
# Avoid warnings by switching to noninteractive
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
12+
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
13+
# this user's GID/UID must match your local user UID/GID to avoid permission issues
14+
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
15+
# https://aka.ms/vscode-remote/containers/non-root-user for details.
16+
ARG USERNAME=vscode
17+
ARG USER_UID=1000
18+
ARG USER_GID=$USER_UID
19+
20+
# Configure apt and install packages
21+
RUN apt-get update \
22+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
23+
#
24+
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
25+
&& apt-get -y install git iproute2 procps lsb-release \
26+
#
27+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
28+
&& groupadd --gid $USER_GID $USERNAME \
29+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
30+
# [Optional] Add sudo support for the non-root user
31+
&& apt-get install -y sudo \
32+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
33+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
34+
#
35+
# Clean up
36+
&& apt-get autoremove -y \
37+
&& apt-get clean -y \
38+
&& rm -rf /var/lib/apt/lists/*
39+
40+
# Switch back to dialog for any ad-hoc use of apt-get
41+
ENV DEBIAN_FRONTEND=dialog
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "F# (.NET Core 3.0)",
3+
"dockerFile": "Dockerfile",
4+
5+
// Use 'settings' to set *default* container specific settings.json values on container create.
6+
// You can edit these settings after create using File > Preferences > Settings > Remote.
7+
//
8+
// .NET Core is now the default for F# in .NET Core 3.0
9+
// However, .NET Core scripting is not the default yet. Set that to true.
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/bash",
12+
"FSharp.useSdkScripts":true
13+
},
14+
15+
// Use 'appPort' to create a container with published ports. If the port isn't working, be sure
16+
// your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost.
17+
// "appPort": [],
18+
19+
// Uncomment the next line to run commands after the container is created.
20+
// "postCreateCommand": "dotnet restore",
21+
22+
// Uncomment the next line to use a non-root user. On Linux, this will prevent
23+
// new files getting created as root, but you may need to update the USER_UID
24+
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
25+
// "runArgs": [ "-u", "vscode" ],
26+
27+
// Add the IDs of extensions you want installed when the container is created in the array below.
28+
"extensions": [
29+
"Ionide.Ionide-fsharp",
30+
"ms-vscode.csharp"
31+
]
32+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
README.md
2+
test-project
3+
.vscode
4+
.npmignore
5+
.ionide
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/test-project/bin/Debug/netcoreapp3.0/app.dll",
13+
"args": [],
14+
"cwd": "${workspaceFolder}/test-project",
15+
"console": "integratedTerminal",
16+
"stopAtEntry": false,
17+
"internalConsoleOptions": "openOnSessionStart"
18+
},
19+
{
20+
"name": ".NET Core Attach",
21+
"type": "coreclr",
22+
"request": "attach",
23+
"processId": "${command:pickProcess}"
24+
}
25+
]
26+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"razor.disabled": true
3+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"command": "cd test-project && dotnet build",
9+
"type": "shell",
10+
"group": "build",
11+
"presentation": {
12+
"reveal": "silent"
13+
},
14+
"problemMatcher": "$msCompile"
15+
}
16+
]
17+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# F# (.NET Core Latest)
2+
3+
## Summary
4+
5+
*Develop F# and .NET Core (latest) based applications. Includes all needed SDKs, extensions, and dependencies.*
6+
7+
| Metadata | Value |
8+
|----------|-------|
9+
| *Contributors* | The VS Code Team, F# team |
10+
| *Definition type* | Dockerfile |
11+
| *Languages, platforms* | .NET Core, F# |
12+
13+
## Using this definition with an existing folder
14+
15+
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
16+
17+
```json
18+
"console": "integratedTerminal"
19+
```
20+
21+
Beyond that, just follow these steps to use the definition:
22+
23+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
24+
25+
2. To use VS Code's copy of this definition:
26+
1. Start VS Code and open your project folder.
27+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Add Development Container Configuration Files...** from the command palette.
28+
3. Select the F# (.NET Core Latest) definition.
29+
30+
3. To use latest-and-greatest copy of this definition from the repository:
31+
1. Clone this repository.
32+
2. Copy the contents of `containers/dotnetcore-latest-fsharp/.devcontainer` to the root of your project folder.
33+
3. Start VS Code and open your project folder.
34+
35+
4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
36+
37+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
38+
39+
## Testing the definition
40+
41+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
42+
43+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
44+
2. Clone this repository.
45+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
46+
4. Select the `containers/dotnetcore-latest-fsharp` folder.
47+
5. When prompted click "Restore" in the notification to restore packages.
48+
6. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
49+
7. You should see "Hello Remote World from the F# Container!" in a terminal window after the program executes.
50+
8. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
51+
52+
## License
53+
54+
Copyright (c) Microsoft Corporation. All rights reserved.
55+
56+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//----------------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
// ----------------------------------------------------------------------------------------
5+
6+
open System
7+
8+
[<EntryPoint>]
9+
let main argv =
10+
let from = "F# Container"
11+
let target = "Remote World"
12+
let message = "Hello " + target + " from the " + from + "!"
13+
printfn "%s" message
14+
15+
0 // return an integer exit code
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.2</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<Compile Include="Program.fs" />
10+
<Reference Include="netstandard" />
11+
</ItemGroup>
12+
13+
</Project>

0 commit comments

Comments
 (0)