From 126830081a9665acb6520736cf4687c0c2550aeb Mon Sep 17 00:00:00 2001 From: Carsten Behring Date: Thu, 23 May 2024 22:14:30 +0200 Subject: [PATCH 1/2] fixes #107 --- .devcontainer/Dockerfile | 28 ++++++++++++++--- .devcontainer/devcontainer.json | 53 ++++++++++++++++++++++----------- CHANGELOG.md | 5 ++++ 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b4b07f7..e5089c0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,25 @@ -FROM mcr.microsoft.com/devcontainers/java:11-bullseye +FROM clojure:temurin-21-tools-deps-1.11.3.1456-jammy + +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 + +# ******************************************************** +# * Anything else you want to do like clean up goes here * +# ******************************************************** + +# [Optional] Set the default user. Omit if you want to keep the default as root. +USER $USERNAME +SHELL ["/bin/bash", "-ec"] +ENTRYPOINT ["bash"] -RUN bash -c "bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)" -RUN bash -c "bash < <(curl -s https://raw.githubusercontent.com/clojure-lsp/clojure-lsp/master/install)" -RUN apt-get update && apt-get install -y rlwrap gfortran libblas-dev liblapack-dev libpng-dev libfontconfig1-dev libfreetype-dev gfortran libicu-dev cmake diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 774c7f5..9d81927 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,31 +1,48 @@ { - "name": "my Clojure app", "build": { "dockerfile": "Dockerfile" + }, - }, - - - "features": { - "ghcr.io/devcontainers-contrib/features/clojure-asdf:2": {}, - "ghcr.io/rocker-org/devcontainer-features/r-apt:0": {} - + "features": { -}, - "forwardPorts": ["12345","7777"], + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": "rlwrap,r-base-dev" + }, + "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {}, + "ghcr.io/rocker-org/devcontainer-features/r-apt:0": {}, + "ghcr.io/rocker-org/devcontainer-features/rstudio-server": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/rocker-org/devcontainer-features/r-packages:1": { + "packages": "nloptr,Rserve,ranger,randomForest,ggthemes,ggplot2,mice,dplyr", + "additionalRepositories": "rforge= 'https://rforge.net'", + "installSystemRequirements": true + }, + "ghcr.io/wxw-matt/devcontainer-features/command_runner:latest": { + "command1": "bash < <(curl -s https://raw.githubusercontent.com/clojure-lsp/clojure-lsp/master/install)", + "command2": "bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)", + "command3": "bash -c 'wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -O /usr/local/bin/lein && chmod +x /usr/local/bin/lein'" + } + }, + "overrideFeatureInstallOrder": [ + "ghcr.io/rocker-org/devcontainer-features/r-apt", + "ghcr.io/devcontainers-contrib/features/apt-get-packages", + "ghcr.io/rocker-org/devcontainer-features/r-packages" + ], + "forwardPorts": [12345], + "portsAttributes": { + "12345": { + "label": "nrepl" + } + }, "customizations": { "vscode": { - "settings": { - }, - "extensions": - [ - "vscjava.vscode-java-pack", - "borkdude.clj-kondo", + "extensions": [ "betterthantomorrow.calva" ] } }, - "remoteUser": "vscode", - "onCreateCommand": "Rscript -e 'pak::pkg_install(c(\"ranger\",\"randomForest\",\"ggthemes\",\"ggplot2\",\"mice\",\"dplyr\",\"url::https://rforge.net/Rserve/snapshot/Rserve_1.8-12.tar.gz\"))'" + "postAttachCommand": + { "prepare": ["bash","-c", "-i", "source ./.devcontainer/setup.sh"] + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index f7f3dd4..f36d16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). +## unreleased + +- use devcontainer setup following template + + ## [1.0.0] - `require-r` creates namespace as `r.namespace`, also `namespace` as an alias - dependencies update, TMD 7.029 From 08ebc4c8a92bd1a76fcd0cb96afb0dfd23af338c Mon Sep 17 00:00:00 2001 From: Carsten Behring Date: Mon, 27 May 2024 21:16:10 +0200 Subject: [PATCH 2/2] added forgoten setup file --- .devcontainer/setup.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000..b187cd0 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,3 @@ +#!/bin/bash -xe + +clj -Sthreads 1 -P