From b6c679b89ea9edc8d3e2ad2f7ddb62e1b97d4a6e Mon Sep 17 00:00:00 2001 From: jwhitlark Date: Tue, 10 Oct 2023 22:49:56 +0000 Subject: [PATCH 1/3] initial setup of devcontainer --- .devcontainer/Dockerfile.dev | 19 +++++++++++++++++++ .devcontainer/devcontainer.json | 22 ++++++++++++++++++++++ resources/md/guestbook.md | 7 +++++++ 3 files changed, 48 insertions(+) create mode 100644 .devcontainer/Dockerfile.dev create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile.dev b/.devcontainer/Dockerfile.dev new file mode 100644 index 0000000..d284364 --- /dev/null +++ b/.devcontainer/Dockerfile.dev @@ -0,0 +1,19 @@ +FROM clojure:temurin-20-tools-deps-jammy +# Details as of 2023-09-19: +# Ubuntu: Ubuntu 22.04 LTS (Jammy Jellyfish) +# JDK: eclipse-temurin 20 +# Clojure: tools-deps, 1.11.1.1347 + +# Extra tools +RUN apt-get update && apt-get install -y gpg curl + +# Install new and clj-new (prefer new, but clj-new is needed for some templates) + +RUN clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new +RUN clojure -Ttools install-latest :lib com.github.seancorfield/clj-new :as clj-new + +# Add Babashka + +RUN curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install \ + && chmod +x install \ + && ./install --static \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..db5f343 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "name": "Clojure kit tutorial", + "build": { + "dockerfile": "Dockerfile.dev" + }, + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // More info: https://containers.dev/features. + "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Run commands on cluster first start. Useful for download dependencies, etc. + // "postCreateCommand": "", + // Copy host env vars into the devcontainer. You can also refer to some_file.env files in your docker or docker-compose setup. + "remoteEnv": {}, + "customizations": { + "vscode": { + "extensions": [ + "betterthantomorrow.calva" + ] + } + } +} \ No newline at end of file diff --git a/resources/md/guestbook.md b/resources/md/guestbook.md index dcec6c1..6642f55 100644 --- a/resources/md/guestbook.md +++ b/resources/md/guestbook.md @@ -7,6 +7,13 @@ project architecture. If you don't have a preferred Clojure editor already, then it's recommended that you use [Calva](https://calva.io/getting-started/) to follow along with this tutorial. +## Quickstart via Devcontainers or Github Codespaces +If you have configured your Github account, you can start the project without any other setup. It will open a web-based vscode editor backed by a Github Codespace VM. (Codespaces is Github's hosted Devcontainer solution) + +[![Open in Github Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/jwhitlark/kit-clj.github.io) + +You can also clone this repo locally, and using vscode (with the devcontainer plugin), and Docker Desktop, run an isolated, fully setup version of this application locally. Open the repo in your editor and run the command `Dev Containers: Open Folder in Container...`. + ### Installing JDK Clojure runs on the JVM and requires a copy of JDK to be installed. If you don't From f411643f031b53f39e343a3e2dc272eb84d59b09 Mon Sep 17 00:00:00 2001 From: jwhitlark Date: Tue, 10 Oct 2023 22:58:36 +0000 Subject: [PATCH 2/3] almost there --- resources/md/guestbook.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/md/guestbook.md b/resources/md/guestbook.md index 6642f55..f9e7dba 100644 --- a/resources/md/guestbook.md +++ b/resources/md/guestbook.md @@ -14,6 +14,8 @@ If you have configured your Github account, you can start the project without an You can also clone this repo locally, and using vscode (with the devcontainer plugin), and Docker Desktop, run an isolated, fully setup version of this application locally. Open the repo in your editor and run the command `Dev Containers: Open Folder in Container...`. +Once you're running in a devcontainer, open a terminal and jump to [Creating a new application](#creating-a-new-application) + ### Installing JDK Clojure runs on the JVM and requires a copy of JDK to be installed. If you don't From 39ccf6a582b76c69d57413acda970641b57001f8 Mon Sep 17 00:00:00 2001 From: jwhitlark Date: Tue, 10 Oct 2023 23:22:28 +0000 Subject: [PATCH 3/3] ignore devcontainer artifacts and the sample project. --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 0df6924..fd59db5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,9 @@ *.iml */.DS_Store target/ + +# Devcontainer ignores +.clj-kondo/* +.lsp/* +# Tutorial project, comment out if you want to save your work. +guestbook/* \ No newline at end of file