e9ec96aee7 | ||
---|---|---|
.. | ||
.devcontainer | ||
test-project | ||
.npmignore | ||
README.md |
README.md
IMPORTANT NOTE: This Template is deprecated and is no longer supported.
Clojure (Community)
Summary
Develop Clojure applications. Includes the Calva and clj-kondo extensions.
Metadata | Value |
---|---|
Contributors | Christopher Miles, Matthew Ferry |
Categories | Community, Languages |
Definition Type | Dockerfile |
Works in Codespaces | Yes |
Container host OS support | Linux, MacOS, Windows |
Container OS | Debian |
Languages, platforms | Clojure |
Using this definition
While this definition should work unmodified, you can select the version of Java the container uses by updating the VARIANT
arg in the included devcontainer.json
(and rebuilding if you've already created the container).
// Or you can use 17-bullseye or 17-buster if you want to pin to an OS version
"args": { "VARIANT": "17" }
Installing a Specific Clojure Version
You can set the default Clojure version used by Boot as well as the version of Clojure that is pre-loaded with Leiningen by adding the "CLOJURE_VERSION"
to the build arguments in .devcontainer/devcontainer.json
.
"args": {
"CLOJURE_VERSION": "1.10.3"
}
Installing Clojure CLI Tools
The Clojure command line tools will be installed by default but you can change this behavior by setting the "INSTALL_CLOJURE_CLI"
build argument to false in
.devcontainer/devcontainer.json
. The version of the tools may be set with the "CLOJURE_CLI_VERSION"
argument.
"args": {
"INSTALL_CLOJURE_CLI": "false"
}
Installing Boot
The Boot command line tools will be installed by default but you can change this behavior by setting the "INSTALL_BOOT"
build argument to false in .devcontainer/devcontainer.json
. The version of Boot may be set with the "BOOT_VERSION"
argument.
"args": {
"INSTALL_BOOT": "false"
}
Boot will use the same Clojure verson as specified with the "CLOJURE_VERSION"
argument. You may set a specific version just for Boot by customizing the "BOOT_CLOJURE_VERSION"
environment variable.
"args": {
"BOOT_CLOJURE_VERSION": "1.10.3"
}
Installing Leiningen
Leiningen will be installed by default but you can change this behavior by setting the "INSTALL_LEININGEN"
build argument to false in .devcontainer/devcontainer.json
. The version of Leiningen may be set with the "LEININGEN_VERSION"
argument, the default value is "stable".
"args": {
"INSTALL_LEININGEN": "false"
}
Installing Polylith
Polylith will be installed by default but you can change this behavior by setting the "INSTALL_POLYLITH"
build argument to false in .devcontainer/devcontainer.json
. The version of Polylith may be set with the "POLYLITH_VERSION"
argument.
"args": {
"POLYLITH_LEININGEN": "false"
}
Installing Node.js
Clojurescript is a compiler for Clojure that targets Javascript. By default the newest long term support release of NodeJS will be installed but you can change this behavior by setting the "NODE_VERSION"
argument. Setting this argument to "none" will prevent the installation of NodeJS.
"args": {
"NODE_VERSION": "10" // Set to "none" to skip Node.js installation
}
This container also includes nvm
so that you can easily install and switch between multiple Node.js versions.
Adding the definition to your folder
-
If this is your first time using a development container, please see getting started information on setting up Remote-Containers or creating a codespace using GitHub Codespaces.
-
To use the pre-built image:
- Start VS Code and open your project folder or connect to a codespace.
- Press F1 select and Add Development Container Configuration Files... command for Remote-Containers or Codespaces.
- Select this definition. You may also need to select Show All Definitions... for it to appear.
-
To build a custom version of the image instead:
- Clone this repository locally.
- Start VS Code and open your project folder or connect to a codespace.
- Use your local operating system's file explorer to drag-and-drop the locally cloned copy of the
.devcontainer
folder for this definition into the VS Code file explorer for your opened project or codespace. - Update
.devcontainer/devcontainer.json
to reference"dockerfile": "base.Dockerfile"
.
-
After following step 2 or 3, the contents of the
.devcontainer
folder in your project can be adapted to meet your needs. -
Finally, press F1 and run Remote-Containers: Reopen Folder in Container or Codespaces: Rebuild Container to start using the definition.
Testing the definition
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
-
If this is your first time using a development container, please follow the getting started steps to set up your machine.
-
Clone this repository.
-
Start VS Code, press F1, and select Remote-Containers: Open Folder in Container...
-
Select the
containers/clojure
folder. -
To test Clojure:
- Open the "test-project" folder and click on the
project.clj
file to open the project file. - Open the command palette and choose "Calva: Start a Project REPL and Connect (aka Jack-In)".
- When prompted for a project type, choose "Leiningen".
- A new Clojure REPL panel will appear, type
(require 'sample)
and press "alt+enter". - Type
(sample/main)
and press "alt+enter". - Should return "Hello world".
- Open the "test-project" folder and click on the
-
To test ClojureScript with Node:
- Open the "test-project" folder and click on the
project.clj
file to open the project file. - Open the command palette and choose "Calva: Start a Project REPL and Connect (aka Jack-In)".
- When prompted for a project type, choose "Leiningen + ClojureScript built-in for node"
- A new ClojureScript REPL panel will appear, type
(require 'sample.main)
and press "alt+enter". - Should return "Hello world".
- Open the "test-project" folder and click on the
-
From here, you can add breakpoints or edit the contents of the
test-project
folder to do further testing.
License
Licensed under the MIT License. See LICENSE.