You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2022/09/01 16:05:48 UTC

[couchdb] 19/31: update devcontainer

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch raft_storemodule
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 87fe58999fb8d4ddeefd2e0cbb880f89f447f105
Author: Zach Lankton <za...@gmail.com>
AuthorDate: Mon Aug 15 17:17:25 2022 +0000

    update devcontainer
---
 .devcontainer/Dockerfile        | 31 ++++++++++---------------------
 .devcontainer/devcontainer.json | 30 ++++++++++++++++++++----------
 README-DEV.rst                  | 15 +++++++++++++++
 README.rst                      | 18 ++++++++++++++++++
 4 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 04a117cb2..46a09d0cf 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,24 +1,13 @@
-ARG ELIXIR_VERSION
-FROM elixir:${ELIXIR_VERSION}
+ARG IMG
+FROM ${IMG}
 
-# Install SpiderMonkey 60 and tell CouchDB to use it in configure
-ENV SM_VSN=60
+# Install SpiderMonkey 78 and tell CouchDB to use it in configure
+ENV SM_VSN=78
 
-# Use NodeSource binaries for Node.js (Fauxton dependency)
-RUN set -ex; \
-    curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -; \
-    echo "deb https://deb.nodesource.com/node_10.x buster main" | tee /etc/apt/sources.list.d/nodesource.list; \
-    echo "deb-src https://deb.nodesource.com/node_10.x buster main" | tee -a /etc/apt/sources.list.d/nodesource.list
+USER root
 
-RUN set -ex; \
-    apt-get update; \
-    apt-get install -y --no-install-recommends \
-        libmozjs-${SM_VSN}-dev \
-        libicu-dev \
-        python3-venv \
-        python3-pip \
-        python3-sphinx \
-        nodejs
-
-# Documentation theme
-RUN pip3 install sphinx_rtd_theme
+# These lines are necessary if the user has cloned the repo to their local machine
+# and clicked the "Reopen in container button"
+RUN mkdir -p /workspaces/couchdb
+WORKDIR /workspaces/couchdb
+COPY . .
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 666f9fa16..5dbf45dbd 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,19 +1,29 @@
 {
     "build": {
         "dockerfile": "Dockerfile",
+        "context": "..",
         "args": {
+            "name": "couchdb-dev",
             // Useful choices include:
-            // 1.11 -> Erlang 23, Debian Buster
-            // 1.10 -> Erlang 22, Debian Buster
-            // 1.9  -> Erlang 22, Debian Buster
+            // apache/couchdbci-debian:bullseye-erlang-25.0.2
+            // apache/couchdbci-debian:bullseye-erlang-24.3.4.2
+            // apache/couchdbci-debian:bullseye-erlang-23.3.4.15
             //
-            // Older versions based on Debian Stretch will not include
-            // SpiderMonkey 60, which the Dockerfile expects to be able
-            // to install via apt-get.
-            "ELIXIR_VERSION": "1.10"
+            "IMG": "apache/couchdbci-debian:bullseye-erlang-25.0.2"
         }
     },
-    "extensions": [
-        "erlang-ls.erlang-ls"
-    ]
+
+    // We are using a volume mount to improve performance
+    // https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-named-volume-for-your-entire-source-tree
+    //
+    // and eliminate test flake.
+    // https://github.com/apache/couchdb/discussions/4145
+    //
+    // Your code will not be bound to the host OS folder you started this project from.
+    // Your code will live inside the volume created for the container under /workspace.
+    "workspaceMount": "target=/workspaces/couchdb,type=volume",
+    "workspaceFolder": "/workspaces/couchdb",
+    "postCreateCommand": "./configure && make",
+
+    "extensions": ["erlang-ls.erlang-ls"]
 }
diff --git a/README-DEV.rst b/README-DEV.rst
index 863218de9..84e16def7 100644
--- a/README-DEV.rst
+++ b/README-DEV.rst
@@ -64,6 +64,21 @@ associated ``devcontainer.json`` file to quickly provision a
 development environment using `GitHub Codespaces <https://github.com/features/codespaces>`_
 or `Visual Studio Code <https://code.visualstudio.com/docs/remote/containers>`_.
 
+
+.. image:: https://img.shields.io/static/v1?label=Remote%20-%20Containers&message=Open&color=blue&logo=visualstudiocode
+    :target: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb
+
+If you already have VS Code and Docker installed, you can click the badge above or 
+`here <https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb>`_ 
+to get started. Clicking these links will cause VS Code to automatically install the 
+Remote - Containers extension if needed, clone the source code into a container volume, 
+and spin up a dev container for use.
+
+This ``devcontainer`` will automatically run ``./configure && make`` the first time it is created.  
+While this may take some extra time to spin up, this tradeoff means you will be able to 
+run things like ``./dev/run`` and ``make check`` straight away.  Subsequent startups should be quick.
+
+
 Debian-based (inc. Ubuntu) Systems
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/README.rst b/README.rst
index e6d294ceb..6bb69cd09 100644
--- a/README.rst
+++ b/README.rst
@@ -60,6 +60,24 @@ Run a basic test suite for CouchDB by browsing here:
 Getting started with developing
 -------------------------------
 
+**Quickstart:**
+
+
+.. image:: https://img.shields.io/static/v1?label=Remote%20-%20Containers&message=Open&color=blue&logo=visualstudiocode
+    :target: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb
+
+If you already have VS Code and Docker installed, you can click the badge above or 
+`here <https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb>`_ 
+to get started. Clicking these links will cause VS Code to automatically install the 
+Remote - Containers extension if needed, clone the source code into a container volume, 
+and spin up a dev container for use.
+
+This ``devcontainer`` will automatically run ``./configure && make`` the first time it is created.  
+While this may take some extra time to spin up, this tradeoff means you will be able to 
+run things like ``./dev/run`` and ``make check`` straight away.  Subsequent startups should be quick.
+
+**Manual Dev Setup:**
+
 For more detail, read the README-DEV.rst file in this directory.
 
 Basically you just have to install the needed dependencies which are