Skip to content

Instantly share code, notes, and snippets.

@sbamin
Created April 18, 2022 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbamin/be2505732702d8b729ed1a0d0216e700 to your computer and use it in GitHub Desktop.
Save sbamin/be2505732702d8b729ed1a0d0216e700 to your computer and use it in GitHub Desktop.
Wrapper for deno while using it as a shared resource for Quarto framework, https://github.com/quarto-dev/quarto-cli/discussions/380
#!/usr/bin/env bash
# wrapper for running deno (dependency for Quarto) on Cent OS 7
# https://github.com/quarto-dev/quarto-cli/discussions/380
# this wrapper replaces default deno binary (at /share/deno)
# shipped with quarto pre-compiled binaries
# tested ok with https://github.com/quarto-dev/quarto-cli/releases/download/v0.9.254/quarto-0.9.254-linux-amd64.tar.gz
# on Cent OS 7, Linux 3.10.0-1062.1.2.el7.x86_64
# deno binary is not compatible with Cent OS 7 and GLIB 2.17
# https://github.com/denoland/deno/issues/1658
# So, run deno using the docker or singularity based image
# first, make deno_latest.sif using command:
# singuarity run docker://denoland/deno
# for specific version of deno, see https://hub.docker.com/r/denoland/deno
# copy built image to any of Cent OS 7 based HPC or other system
deno_image="${SINGULARITY_SIF}"/deno.sif
if [[ -x "${deno_image}" ]]; then
# let orphaned processes to be re-parented as children of
# Tini program, see subreaping at https://github.com/krallin/tini
export TINI_SUBREAPER=true
# map DENO_DIR as it is owned by root in the container
# https://denolib.gitbook.io/guide/advanced/deno_dir-code-fetch-and-cache
deno_dir="/tmp/deno/deno_dir"
mkdir -p "${deno_dir}"
# run deno
singularity run --bind "${deno_dir}":/deno-dir "${deno_image}" "${@:-"--help"}"
else
echo -e "ERROR: missing singularity container for deno at\n${deno_image}" >&2
exit 1
fi
#### work in progress ####
# while running quarto, ensure to specify relevant jupyter kernel
# where you have python and R installed along with required extensions, e.g.,
# mamba install -c conda-forge nbformat nbclient
# Run "quarto check" command to verify quarto installation.
# See https://quarto.org/docs/computations/jupyter-kernels.html
# end #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment