From 5ee4d9355f771b8c1cdc32fd41eb9d54346e7980 Mon Sep 17 00:00:00 2001
From: Kurt Mueller <kurtronaldmueller@gmail.com>
Date: Fri, 8 Mar 2024 03:18:55 +0000
Subject: [PATCH] Add config for devcontainers

---
 .devcontainer/devcontainer.json | 40 +++++++++++++++++++++++++++++++++
 .github/dependabot.yml          | 12 ++++++++++
 Dockerfile                      | 17 ++++++++++++++
 docker-entrypoint.sh            | 10 +++++++++
 global.json                     |  6 ++---
 5 files changed, 82 insertions(+), 3 deletions(-)
 create mode 100644 .devcontainer/devcontainer.json
 create mode 100644 .github/dependabot.yml
 create mode 100644 Dockerfile
 create mode 100644 docker-entrypoint.sh

diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 000000000..57ba88ea1
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,40 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
+{
+    "name": "Existing Dockerfile",
+    "build": {
+        // Sets the run context to one level up instead of the .devcontainer folder.
+        "context": "..",
+        // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
+        "dockerfile": "../Dockerfile"
+    },
+    "customizations": {
+        "vscode": {
+            "extensions": [
+                "ms-azuretools.vscode-docker",
+                "ms-dotnettools.csdevkit",
+                "Ionide.Ionide-fsharp",
+                "Ionide.Ionide-Paket",
+                "shardulm94.trailing-spaces",
+                "esbenp.prettier-vscode",
+                "DavidAnson.vscode-markdownlint",
+                "yzhang.markdown-all-in-one"
+            ]
+        }
+    }
+
+    // Features to add to the dev container. More info: https://containers.dev/features.
+    // "features": {},
+
+    // Use 'forwardPorts' to make a list of ports inside the container available locally.
+    // "forwardPorts": [],
+
+    // Uncomment the next line to run commands after the container is created.
+    // "postCreateCommand": "cat /etc/os-release",
+
+    // Configure tool-specific properties.
+    // "customizations": {},
+
+    // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
+    // "remoteUser": "devcontainer"
+}
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..f33a02cd1
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,12 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for more information:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+# https://containers.dev/guide/dependabot
+
+version: 2
+updates:
+ - package-ecosystem: "devcontainers"
+   directory: "/"
+   schedule:
+     interval: weekly
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..34a35f3da
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM mcr.microsoft.com/vscode/devcontainers/dotnet:7.0-bookworm-slim
+
+ENV WORKDIR="/app" \
+    USER="vscode"
+
+WORKDIR $WORKDIR
+
+COPY --chown=${USER}:${USER} . ${WORKDIR}
+
+COPY --chown=${USERNAME}:${USERNAME} docker-entrypoint.sh /usr/bin/
+RUN chmod +x /usr/bin/docker-entrypoint.sh
+
+ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
+
+RUN dotnet tool restore && \
+    dotnet paket restore && \
+    dotnet restore
\ No newline at end of file
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
new file mode 100644
index 000000000..40673c63e
--- /dev/null
+++ b/docker-entrypoint.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+
+dotnet tool restore
+dotnet paket restore
+dotnet restore
+
+
+# Exec the container's main process (what's set as CMD in the Dockerfile).
+exec "$@"
\ No newline at end of file
diff --git a/global.json b/global.json
index e3c6e50c8..532b88539 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
 {
   "sdk": {
-    "version": "6.0.203",
-    "rollForward": "major"
+      "version": "7.0.200",
+      "rollForward": "latestFeature"
   }
-}
+}
\ No newline at end of file