Skip to content

Commit

Permalink
Merge pull request #19 from marcitqualab/main
Browse files Browse the repository at this point in the history
Base clojure template
  • Loading branch information
behrica committed Jun 9, 2024
2 parents 698a66c + 8d78577 commit 0676a77
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 165 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
id: filter
with:
filters: |
color: ./**/color/**
hello: ./**/hello/**
scicloj: ./**/scicloj/**
basecloj: ./**/basecloj/**
test:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ src/scicloj/.clj-kondo
src/scicloj/poetry.lock
src/scicloj/.lsp/
src/scicloj/.devcontainer/.devpod-internal
.clj-kondo/
.lsp/

31 changes: 31 additions & 0 deletions src/basecloj/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM clojure:${templateOption:imageTag}

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME


# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME
SHELL ["/bin/bash", "-ec"]
ENTRYPOINT ["bash"]


# Prepare clojure tools
RUN clojure -Ttools list && \
clojure -Ttools install io.github.seancorfield/clj-new '{:git/tag "v1.2.404" :git/sha "d4a6508"}' :as clj-new && \
clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new && \
clojure -Ttools list

RUN sudo apt-get update && \
sudo apt-get install -y lsb-release
23 changes: 23 additions & 0 deletions src/basecloj/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/scicloj/devcontainer-templates/tree/main/src/basecloj
{
"name": "Base clojure dev env",
"build": {
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "${localEnv:USER}"
}
},
"remoteUser": "${localEnv:USER}",
"containerUser": "${localEnv:USER}",
"features": {
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"betterthantomorrow.calva"
]
}
}
}
31 changes: 31 additions & 0 deletions src/basecloj/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@



## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|

>Note: comming soon
# A minimal devcontainer with JAVA, Clojure and minimal clj tools

It sets up a minimal dev container environment with green fields minimal tools for Clojure.

# Quickstart

0. Install [devcontainer cli](https://github.com/devcontainers/cli)
1. Run `devcontainer templates apply -t ghcr.io/scicloj/devcontainer-templates/basecloj` to create a devcontainer setup
with default settings in your current directoty
2. Open folder with VSCode / devcontainer / devpod / Codespaces and trigger/wait for container build
3. [Start the Calva repl](https://calva.io/getting-started/)


4. Create a new app, lib, template and more:
* Read [deps-new](https://github.com/seancorfield/deps-new)
* Read [clj-new docs](https://github.com/seancorfield/clj-new)

## Customization
5. Install more features in devcontainer: https://containers.dev/features

---
24 changes: 24 additions & 0 deletions src/basecloj/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"id": "basecloj",
"version": "1.0.0",
"name": "Base clojure development environment",
"description": "A devcontainer template with the minimum clojure tools and configuration, this template is intended to create new greenfield clojure project that should be further customised on specific project needs. ",
"documentationURL": "https://github.com/scicloj/devcontainer-templates/tree/main/src/basecloj",
"licenseURL": "https://github.com/scicloj/devcontainer-templates/blob/main/LICENSE",
"options": {
"imageTag": {
"type": "string",
"description": "Tag of official Clojure image",
"proposals": [
"temurin-8-tools-deps-jammy",
"temurin-11-tools-deps-jammy",
"temurin-17-tools-deps-jammy",
"temurin-21-tools-deps-jammy"
],
"default": "temurin-21-tools-deps-jammy"
}
},
"platforms": [
"Any"
]
}
18 changes: 0 additions & 18 deletions src/color/.devcontainer/devcontainer.json

This file was deleted.

17 changes: 0 additions & 17 deletions src/color/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions src/color/devcontainer-template.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/hello/.devcontainer/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions src/hello/.devcontainer/devcontainer.json

This file was deleted.

17 changes: 0 additions & 17 deletions src/hello/README.md

This file was deleted.

34 changes: 0 additions & 34 deletions src/hello/devcontainer-template.json

This file was deleted.

13 changes: 13 additions & 0 deletions test/basecloj/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
cd $(dirname "$0")
source test-utils.sh

# Template specific tests
check "distro" lsb_release -a
check "java_jdk" java --version
check "clojure" clojure --version
check "clj" clj --version
check "user" id

# Report result
reportResults
10 changes: 0 additions & 10 deletions test/color/test.sh

This file was deleted.

10 changes: 0 additions & 10 deletions test/hello/test.sh

This file was deleted.

0 comments on commit 0676a77

Please sign in to comment.