diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2021-01-19 16:57:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 16:57:02 -0500 |
commit | 476787b0f2b34d56870c54c2b4d680151fd088e6 (patch) | |
tree | 05888b139b4c092be3a546a603060e79170beb4d | |
parent | 92318242b9bc5ec4c273a9be5e8c03080e4d780a (diff) | |
download | couchdb-476787b0f2b34d56870c54c2b4d680151fd088e6.tar.gz |
Add a .devcontainer configuration for 3.x (#3336)
This PR adds a Dockerfile and associated configuration to enable
developers to quickly provision an environment with all dependencies
installed to work on CouchDB 3.x.
The container configuration also installs the Erlang Language Server
extension. That extension needs a minimal configuration file in the root
of the project in order to find the include files, so I've added that as
well. We could likely iterate and enhance that configuration file
further with linters, dialyzers configurations, etc.
Finally, it allows a developer to set the SpiderMonkey version in an
$SM_VSN environment variable so that we can do a better job of
preserving the simplicity of `./configure; make` inside the container.
-rw-r--r-- | .devcontainer/Dockerfile | 24 | ||||
-rw-r--r-- | .devcontainer/devcontainer.json | 19 | ||||
-rw-r--r-- | README-DEV.rst | 13 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | erlang_ls.config | 2 |
5 files changed, 59 insertions, 1 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..04a117cb2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +ARG ELIXIR_VERSION +FROM elixir:${ELIXIR_VERSION} + +# Install SpiderMonkey 60 and tell CouchDB to use it in configure +ENV SM_VSN=60 + +# 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 + +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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..666f9fa16 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "build": { + "dockerfile": "Dockerfile", + "args": { + // Useful choices include: + // 1.11 -> Erlang 23, Debian Buster + // 1.10 -> Erlang 22, Debian Buster + // 1.9 -> Erlang 22, Debian Buster + // + // 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" + } + }, + "extensions": [ + "erlang-ls.erlang-ls" + ] +} diff --git a/README-DEV.rst b/README-DEV.rst index f4031b767..c8a52ffd4 100644 --- a/README-DEV.rst +++ b/README-DEV.rst @@ -15,6 +15,7 @@ Dependencies You need the following to run tests: * `Python 3 <https://www.python.org/>`_ +* `Elixir <https://elixir-lang.org/>`_ You need the following optionally to build documentation: @@ -51,6 +52,18 @@ sufficient to enable a Fauxton build. Here is a list of *optional* dependencies for various operating systems. Installation will be easiest, when you install them all. +Docker +~~~~~~ + +CouchDB maintains a ``Dockerfile`` based on Debian that includes all +the dependencies noted above in the `.devcontainer <https://github.com/apache/couchdb/tree/main/.devcontainer>`_ +folder. + +The ``Dockerfile`` can be used on its own, or together with the +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>`_. + Debian-based (inc. Ubuntu) Systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -29,7 +29,7 @@ ERLANG_MD5="false" SKIP_DEPS=0 COUCHDB_USER="$(whoami 2>/dev/null || echo couchdb)" -SM_VSN="1.8.5" +SM_VSN=${SM_VSN:-"1.8.5"} ARCH="$(uname -m)" . ${rootdir}/version.mk diff --git a/erlang_ls.config b/erlang_ls.config new file mode 100644 index 000000000..3d2fc9eb1 --- /dev/null +++ b/erlang_ls.config @@ -0,0 +1,2 @@ +include_dirs: + - "src/" |