From e124bc16c0e6f517198e598b3bc52fb2bf441fb4 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sat, 7 Feb 2026 14:06:01 +0200 Subject: [PATCH] Add docker utilities --- README.md | 40 ++++++++++++++++++++++++++-------------- scheme-venv | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 83a0881..1fdf506 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Tool to create Scheme virtual environments scheme-venv chibi r7rs venv +Note that scheme-venv does not install snow-chibi, akku or any Scheme +implementations. You have to install them yourself into your system. + +### bin/activate First argument is Scheme, second is RnRS and third is path to directory. The directory must not exist. @@ -20,27 +24,35 @@ After the virtual environment is created you can activate is with: After activation you can install packages with either snow-chibi or akku and -they will be installed inside the virtual environment. To run your Scheme code -use either scheme-script or scheme-compile, executables. +they will be installed inside the virtual environment. +### bin/snow-chibi -R6RS: +Install R7RS package from [snow-fort.org](https://snow-fort.org). - akku install chez-srfi - scheme-script main.sps - scheme-compile main.sps - ./main +### bin/akku -R7RS: +Install R6RS package from [akkuscm.org](https://akkuscm.org). - snow-chibi install srfi.64 - scheme-script main.scm - scheme-compile main.scm - ./main +### bin/scheme-script -Note that scheme-venv does not install snow-chibi, akku or any Scheme -implementations. You have to install them yourself into your system. +Run Scheme script. +### bin/scheme-compile + +Compile Scheme code to executable. + +### bin/docker-build + +Build docker venvs docker image. Run this before docker-run or docker-repl. + +### bin/docker-run + +Run command inside venv inside docker. + +### bin/docker-repl + +Run scheme repl inside venv inside docker. ## Supported impelmentations and notes diff --git a/scheme-venv b/scheme-venv index 3487745..1472bb9 100755 --- a/scheme-venv +++ b/scheme-venv @@ -380,4 +380,51 @@ EOF } > "${venvpath}/bin/scheme-venv-info" chmod +x "${venvpath}/bin/scheme-venv-info" +## /bin/Dockerfile +{ +cat << EOF +FROM docker.io/schemers/${implementation}:head +RUN apt-get update && apt-get install -y git make ca-certificates wget xz-utils gcc +WORKDIR /build +RUN git clone https://codeberg.org/retropikzel/scheme-venv.git --depth=1 +RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 +RUN wget https://gitlab.com/-/project/6808260/uploads/094ce726ce3c6cf8c14560f1e31aaea0/akku-1.1.0.amd64-linux.tar.xz && tar -xf akku-1.1.0.amd64-linux.tar.xz && mv akku-1.1.0.amd64-linux akku +WORKDIR /build/chibi-scheme +RUN make +RUN make install +WORKDIR /build/akku +RUN bash install.sh +ENV PATH=/root/.local/bin:\${PATH} +ENV PATH=${venvpath}/bin:\${PATH} +WORKDIR ${venvpath} +EOF +} > "${venvpath}/etc/Dockerfile" + +## /bin/docker-build +{ +cat << EOF +#!/bin/sh +docker build -f ${venvpath}/etc/Dockerfile --tag ${venvname}-${implementation}-${rnrs}-docker-img ${venvpath} +EOF +} > "${venvpath}/bin/docker-build" +chmod +x "${venvpath}/bin/docker-build" + +## /bin/docker-run +{ +cat << EOF +#!/bin/sh +docker run -v "${venvpath}:${venvpath}" -w "${venvpath}" ${venvname}-${implementation}-${rnrs}-docker-img "\$@" +EOF +} > "${venvpath}/bin/docker-run" +chmod +x "${venvpath}/bin/docker-run" + +## /bin/docker-repl +{ +cat << EOF +#!/bin/sh +docker run -it -v "${venvpath}:${venvpath}" -w "${venvpath}" ${venvname}-${implementation}-${rnrs}-docker-img scheme-repl +EOF +} > "${venvpath}/bin/docker-repl" +chmod +x "${venvpath}/bin/docker-repl" + echo "Initialized scheme-venv ${venvpath}, with ${implementation} and ${rnrs}"