Skip to content

Commit

Permalink
Add devcontainer to project
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Mar 14, 2021
1 parent 1a09dc8 commit 0c324da
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM debian:buster-slim


RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
\
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu63 \
libssl1.1 \
libstdc++6 \
zlib1g \
curl \
git \
procps \
wget \
&& rm -rf /var/lib/apt/lists/*


ENV \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
DOTNET_INSTALL_DIR=/usr/share/dotnet/ \
DOTNET_ROOT=/usr/share/dotnet/

COPY ./.devcontainer/install-dotnets.sh global.json* .

RUN /bin/bash install-dotnets.sh

ENV PATH="$DOTNET_ROOT:${PATH}"
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

RUN dotnet --info

# Copy endpoint specific user settings into container to specify
# .NET Core should be used as the runtime.
COPY ./.devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "dotnet",
// Set the build context one level higher so we can grab metadata like global.json
"context": "..",
"dockerFile": "Dockerfile",
"forwardPorts": [
0
],
"extensions": [
"ionide.ionide-fsharp",
"ms-dotnettools.csharp",
"editorconfig.editorconfig",
"ionide.ionide-paket",
"ionide.ionide-fake"
]
}
23 changes: 23 additions & 0 deletions .devcontainer/install-dotnets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# downloads installer script https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
curl -SL --output dotnet-install.sh https://dot.net/v1/dotnet-install.sh


# Attempt to install via global.json first
FILE=global.json
if test -f "$FILE"; then
echo "installing dotnet via $FILE"
/bin/bash dotnet-install.sh --verbose --jsonfile $FILE
fi


# Add additional versions if required
DOTNET_VERSIONS=(
# 'latest'
# '5.0.100'
)
for version in ${DOTNET_VERSIONS[@]}; do
echo "installing dotnet $version"
/bin/bash dotnet-install.sh --verbose --version $version
done
3 changes: 3 additions & 0 deletions .devcontainer/settings.vscode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"FSharp.fsacRuntime":"netcore"
}

0 comments on commit 0c324da

Please sign in to comment.