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/.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 diff --git a/resources/md/guestbook.md b/resources/md/guestbook.md index dcec6c1..f9e7dba 100644 --- a/resources/md/guestbook.md +++ b/resources/md/guestbook.md @@ -7,6 +7,15 @@ 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...`. + +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