diff --git a/.Rbuildignore b/.Rbuildignore index 6c8883b..7cdad51 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,6 +1,7 @@ ^LICENSE\.md$ .github Dockerfile +Dockerfile\.positron _pkgdown.yml ^.*\.Rproj$ ^\.Rproj\.user$ diff --git a/Dockerfile.positron b/Dockerfile.positron new file mode 100644 index 0000000..2994871 --- /dev/null +++ b/Dockerfile.positron @@ -0,0 +1,25 @@ +FROM bioconductor/bioconductor_docker:devel + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends openssh-server r-bioc-biobase \ + && cp -a /usr/lib/R/site-library/BiocGenerics /usr/local/lib/R/site-library/ \ + && cp -a /usr/lib/R/site-library/Biobase /usr/local/lib/R/site-library/ \ + && mkdir -p /var/run/sshd /etc/ssh/sshd_config.d \ + && printf '%s\n' \ + 'PasswordAuthentication yes' \ + 'PermitRootLogin no' \ + 'AllowUsers rstudio' \ + 'AllowTcpForwarding yes' \ + 'AllowStreamLocalForwarding yes' \ + > /etc/ssh/sshd_config.d/positron.conf \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /home/rstudio + +COPY --chown=rstudio:rstudio . /home/rstudio/ + +RUN Rscript -e "options(repos = c(CRAN = 'https://cran.r-project.org')); devtools::install('.', dependencies=FALSE, build_vignettes=TRUE, upgrade=FALSE)" + +EXPOSE 22 + +CMD ["/bin/bash", "-lc", "set -euo pipefail; : \"${PASSWORD:?Set PASSWORD to enable SSH login}\"; echo \"rstudio:${PASSWORD}\" | chpasswd; ssh-keygen -A >/dev/null 2>&1; exec /usr/sbin/sshd -D -e"] diff --git a/README.md b/README.md index afb8cc4..b3a7012 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,21 @@ docker run -e PASSWORD=abc -p 8787:8787 ghcr.io/bioconductor/buildabiocworkshop in a multi-user system (like a shared workstation or compute node). In practice, consider using an environment variable instead of plain text to pass along passwords and other secrets in docker command lines. +## Alternative: connect from Positron over SSH + +This repository also includes `Dockerfile.positron`, which keeps the Bioconductor +base image and package installation steps but starts an SSH server instead of +RStudio Server. Build it explicitly with: + +```sh +docker build -f Dockerfile.positron -t buildabiocworkshop-positron . +export PASSWORD='choose-a-password' +docker run --rm --env PASSWORD -p 2222:22 buildabiocworkshop-positron +``` + +Then connect to `ssh://rstudio@localhost:2222` from a local Positron install +using the same password you supplied in `PASSWORD`. + ## Whatcha get diff --git a/vignettes/HOWTO_BUILD_WORKSHOP.Rmd b/vignettes/HOWTO_BUILD_WORKSHOP.Rmd index bb160e3..77c5195 100644 --- a/vignettes/HOWTO_BUILD_WORKSHOP.Rmd +++ b/vignettes/HOWTO_BUILD_WORKSHOP.Rmd @@ -72,7 +72,9 @@ Edit the file _pkgdown.yml, updating the url:, title and href: which should be y ### 5. Edit `.github/workflows yaml` as needed (likely no need) -You do not need to create a docker image manually. Github actions will read Dockerfile located in this template, and using the yaml files will create, build and push to the Github Container Registry an image with the name (default) `ghcr.io/yourgithubuser/yourgithubreponame`, all lowercase. +You do not need to create a docker image manually. Github actions will read `Dockerfile` located in this template, and using the yaml files will create, build and push to the Github Container Registry an image with the name (default) `ghcr.io/yourgithubuser/yourgithubreponame`, all lowercase. + +If you want a Positron-oriented alternative, this template also ships with `Dockerfile.positron`. Build that variant explicitly with `docker build -f Dockerfile.positron .`; it starts `sshd` so that a locally installed Positron client can attach with Remote SSH instead of using RStudio Server in the browser. In the DESCRIPTION file, the **DockerImage: should match your the docker image name (should be lowercase)**. @@ -82,4 +84,3 @@ In the DESCRIPTION file, the **DockerImage: should match your the docker image n Edit the README.md. and add one or more Rmd vignettes that will constitute the workshop materials. It is normal R package that should pass `rcmdcheck::rcmdcheck()`, and be installed using regular R package install commands. -