summaryrefslogtreecommitdiffstats
path: root/.devcontainer
diff options
context:
space:
mode:
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile28
-rw-r--r--.devcontainer/devcontainer.json62
-rw-r--r--.devcontainer/library-scripts/azcli-debian.sh33
3 files changed, 123 insertions, 0 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 0000000..10ed73b
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,28 @@
+# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.163.1/containers/dotnet/.devcontainer/base.Dockerfile
+
+# [Choice] .NET version: 5.0, 3.1, 2.1
+ARG VARIANT="5.0"
+FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:0-${VARIANT}
+
+# [Option] Install Node.js
+ARG INSTALL_NODE="true"
+ARG NODE_VERSION="lts/*"
+RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
+
+# [Option] Install Azure CLI
+ARG INSTALL_AZURE_CLI="false"
+COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
+RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
+ && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
+
+# [Option] Preserve command history
+ARG USERNAME=vscode
+ARG HISTFILE=/commandhistory/.zsh_history
+RUN mkdir /commandhistory && touch /commandhistory/.zsh_history && chown -R $USERNAME /commandhistory
+
+# [Optional] Uncomment this section to install additional OS packages.
+# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+# && apt-get -y install --no-install-recommends <your-package-list-here>
+
+# [Optional] Uncomment this line to install global node packages.
+# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 \ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..a5dc476
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,62 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.163.1/containers/dotnet
+{
+ "name": "C# (.NET)",
+ "build": {
+ "dockerfile": "Dockerfile",
+ "args": {
+ // Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0
+ "VARIANT": "5.0",
+ // Options
+ "INSTALL_NODE": "false",
+ "NODE_VERSION": "lts/*",
+ "INSTALL_AZURE_CLI": "false"
+ }
+ },
+
+ // Set *default* container specific settings.json values on container create.
+ "settings": {
+ "terminal.integrated.shell.linux": "/bin/zsh"
+ },
+
+ // Add the IDs of extensions you want installed when the container is created.
+ "extensions": [
+ "ms-dotnettools.csharp",
+ "eamodio.gitlens",
+ "leo-labs.dotnet",
+ "tintoy.msbuild-project-tools",
+ "formulahendry.dotnet-test-explorer"
+ ],
+
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ // "forwardPorts": [5000, 5001],
+
+ // [Optional] To reuse of your local HTTPS dev cert:
+ //
+ // 1. Export it locally using this command:
+ // * Windows PowerShell:
+ // dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
+ // * macOS/Linux terminal:
+ // dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
+ //
+ // 2. Uncomment these 'remoteEnv' lines:
+ // "remoteEnv": {
+ // "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
+ // "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
+ // },
+ //
+ // 3. Do one of the following depending on your scenario:
+ // * When using GitHub Codespaces and/or Remote - Containers:
+ // 1. Start the container
+ // 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
+ // 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
+ //
+ // * If only using Remote - Containers with a local container, uncomment this line instead:
+ // "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
+
+ // Use 'postCreateCommand' to run commands after the container is created.
+ "postCreateCommand": "dotnet restore",
+
+ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+ "remoteUser": "vscode"
+}
diff --git a/.devcontainer/library-scripts/azcli-debian.sh b/.devcontainer/library-scripts/azcli-debian.sh
new file mode 100644
index 0000000..b03dcb0
--- /dev/null
+++ b/.devcontainer/library-scripts/azcli-debian.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+#-------------------------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
+#-------------------------------------------------------------------------------------------------------------
+#
+# Docs: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/azcli.md
+#
+# Syntax: ./azcli-debian.sh
+
+set -e
+
+if [ "$(id -u)" -ne 0 ]; then
+ echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
+ exit 1
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+
+# Install curl, apt-transport-https, lsb-release, or gpg if missing
+if ! dpkg -s apt-transport-https curl ca-certificates lsb-release > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then
+ if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
+ apt-get update
+ fi
+ apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2
+fi
+
+# Install the Azure CLI
+echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list
+curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
+apt-get update
+apt-get install -y azure-cli
+echo "Done!" \ No newline at end of file