Skip to content

Commit

Permalink
Merge pull request #15 from espm-157/main
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
cboettig authored Nov 27, 2023
2 parents 4a54d4c + e7c00e0 commit 30719c5
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 14 deletions.
16 changes: 13 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# devcontainer-focused Rocker
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.3


ENV NB_USER=rstudio
ENV VIRTUAL_ENV=/opt/venv
ENV PATH=${PATH}:${VIRTUAL_ENV}/bin
ADD https://raw.githubusercontent.com/rocker-org/rocker-versioned2/c1a472465532c8349cf0ad4f3f95c86e85787dc3/scripts/install_python.sh install_python.sh
RUN bash install_python.sh && rm install_python.sh


RUN apt-get update && apt-get -y install libxt6
RUN /rocker_scripts/install_python.sh
ADD https://raw.githubusercontent.com/rocker-org/rocker-versioned2/master/scripts/experimental/install_dev_osgeo.sh install_dev_osgeo.sh
RUN bash install_dev_osgeo.sh && rm install_dev_osgeo.sh

RUN chown -R rstudio:rstudio /opt/venv

USER rstudio
WORKDIR /home/rstudio
RUN usermod -s /bin/bash rstudio

COPY requirements.txt requirements.txt
ENV PATH=$PATH:/home/rstudio/.local/bin

RUN pip install --user -r requirements.txt && rm requirements.txt
RUN python -m pip install -r requirements.txt && rm requirements.txt
COPY install.R install.R
RUN Rscript install.R && rm install.R

# some teaching preferences
RUN git config --global pull.rebase false
RUN git config --global pull.rebase false
8 changes: 4 additions & 4 deletions .devcontainer/install.R
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#! /usr/local/bin/Rscript
# install R dependencies

# We could use renv.lock approach here instead, but will force re-creation of environment from scratch
# Does not provide a good way to ensure that sf/terra/gdalcubes are installed from source while other packages can be binary

install.packages(c("rstac", "spData"))
remotes::install_github("boettiger-lab/earthdatalogin")
install.packages(c("rstac", "spData", "earthdatalogin", "quarto"))
remotes::install_github('r-tmap/tmap')

#install.packages(c("IRkernel", "languageserver", "httpgd"))
#IRkernel::installspec()
install.packages(c("IRkernel", "languageserver", "httpgd"))
IRkernel::installspec()
8 changes: 1 addition & 7 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@

sudo cp /etc/rstudio/disable_auth_rserver.conf /etc/rstudio/rserver.conf
sudo sudo bash -c 'echo "USER=rstudio" >>/etc/environment'
sudo /init &

## set startup dir
mkdir -p ~/.local/share/rstudio/projects_settings
export RPROJ"=$(ls ${CODESPACE_VSCODE_FOLDER}/*.Rproj)"
echo ${RPROJ} > ~/.local/share/rstudio/projects_settings/last-project-path

sudo /init &> /dev/null &

5 changes: 5 additions & 0 deletions .devcontainer/welcome.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
mkdir -p ~/.local/share/rstudio/projects_settings
export RPROJ"=$(ls ${CODESPACE_VSCODE_FOLDER}/*.Rproj)"
echo ${RPROJ} > ~/.local/share/rstudio/projects_settings/last-project-path


# Construct the message
message="## [Open in RStudio](https://$CODESPACE_NAME-8787.app.github.dev)
"
Expand Down
4 changes: 4 additions & 0 deletions .gitpod-resume.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

sudo rstudio-server start

13 changes: 13 additions & 0 deletions .gitpod-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

sudo cp /etc/rstudio/disable_auth_rserver.conf /etc/rstudio/rserver.conf
cp /etc/environment env
echo "USER=$USER" >> env
sudo mv env /etc/environment

mkdir -p ~/.local/share/rstudio/projects_settings
export RPROJ"=$(ls -d $PWD/*.Rproj)"
echo ${RPROJ} > ~/.local/share/rstudio/projects_settings/last-project-path

sudo rstudio-server start

3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
image: ghcr.io/boettiger-lab/nasa-tops:latest
tasks:
- name: rstudio-init
command: bash .gitpod-setup.sh

0 comments on commit 30719c5

Please sign in to comment.