diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d873743..8461dd6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,11 +3,6 @@ "image": "ghcr.io/geocompx/minimal:latest", "customizations": { "vscode": { - "settings": { - "r.rterm.linux": "/usr/local/bin/arf", - "r.rterm.option": [], - "r.bracketedPaste": true - }, "extensions": [ "REditorSupport.r", "quarto.quarto", diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 49d4990..f66273f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -38,20 +38,19 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - if: github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - if: github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' + - name: Build and push (push skipped on pull_request) uses: docker/build-push-action@v6 with: context: . file: ${{ inputs.dockerfile }} - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} secrets: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29da0a4..7be4596 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: branches: - 'master' - 'main' + pull_request: + branches: + - 'master' + - 'main' workflow_dispatch: # Allows manual triggering jobs: diff --git a/README.Rmd b/README.Rmd index 4c5bdcc..f856a33 100644 --- a/README.Rmd +++ b/README.Rmd @@ -48,11 +48,7 @@ If not, see documentation on using Docker at websites such as [docker.com](https ## Devcontainers and VS Code support -The R-enabled images in this repository (`latest`, `minimal`, `osgeo`, `pythonr`) fully support VS Code Devcontainers. When you launch a devcontainer using one of these images: - -* **Alternative R Frontend (arf)** is pre-installed system-wide to `/usr/local/bin/arf`, providing a highly improved interactive R shell with bracketed paste, multi-line editing, and syntax highlighting. -* VS Code is automatically configured via container metadata to use `arf` as the default R terminal frontend out-of-the-box. -* For interactive convenience, the `R` command is aliased system-wide (`alias R=arf`) in bash terminals. Typing `R` in an interactive shell automatically routes to the `arf` console. (This is safe as shell aliases only apply in interactive bash shells and do not interfere with standard non-interactive scripts running package installations or build pipelines). +The R-enabled images in this repository (`latest`, `minimal`, `osgeo`, `pythonr`) fully support VS Code Devcontainers. ## Sharing folders with Docker diff --git a/README.md b/README.md index 51ce715..2aa6101 100644 --- a/README.md +++ b/README.md @@ -55,20 +55,7 @@ If not, see documentation on using Docker at websites such as ## Devcontainers and VS Code support The R-enabled images in this repository (`latest`, `minimal`, `osgeo`, -`pythonr`) fully support VS Code Devcontainers. When you launch a -devcontainer using one of these images: - -- **Alternative R Frontend (arf)** is pre-installed system-wide to - `/usr/local/bin/arf`, providing a highly improved interactive R shell - with bracketed paste, multi-line editing, and syntax highlighting. -- VS Code is automatically configured via container metadata to use - `arf` as the default R terminal frontend out-of-the-box. -- For interactive convenience, the `R` command is aliased system-wide - (`alias R=arf`) in bash terminals. Typing `R` in an interactive shell - automatically routes to the `arf` console. (This is safe as shell - aliases only apply in interactive bash shells and do not interfere - with standard non-interactive scripts running package installations or - build pipelines). +`pythonr`) fully support VS Code Devcontainers. ## Sharing folders with Docker diff --git a/dockerfiles/archive/binder/Dockerfile b/dockerfiles/archive/binder/Dockerfile index 6211245..fb8247a 100644 --- a/dockerfiles/archive/binder/Dockerfile +++ b/dockerfiles/archive/binder/Dockerfile @@ -1,6 +1,4 @@ FROM rocker/binder USER root RUN R -e "install.packages('geocompkg', upgrade = TRUE, dependencies = TRUE, force = TRUE, repos = c('https://geocompr.r-universe.dev', 'https://mlr-org.r-universe.dev', 'https://cloud.r-project.org'))" -# Install arf — Alternative R Frontend (https://github.com/eitsupi/arf) -RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/eitsupi/arf/releases/latest/download/arf-console-installer.sh | sh USER $NB_USER \ No newline at end of file diff --git a/dockerfiles/archive/geocompy/Dockerfile b/dockerfiles/archive/geocompy/Dockerfile index a2c936c..6c5c9ba 100644 --- a/dockerfiles/archive/geocompy/Dockerfile +++ b/dockerfiles/archive/geocompy/Dockerfile @@ -1,4 +1,2 @@ FROM glcr.b-data.ch/r/geospatial RUN R -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org/'); pak::pak('geocompx/geocompkg', upgrade = TRUE)" -# Install arf — Alternative R Frontend (https://github.com/eitsupi/arf) -RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/eitsupi/arf/releases/latest/download/arf-console-installer.sh | sh diff --git a/minimal/Dockerfile b/minimal/Dockerfile index a79a74a..79c9907 100644 --- a/minimal/Dockerfile +++ b/minimal/Dockerfile @@ -5,14 +5,9 @@ ARG QUARTO_VERSION=1.9.37 # Ship editor defaults with the image so downstream Codespaces/devcontainers # inherit Quarto support even when they only reference the published image. -LABEL devcontainer.metadata='[{"customizations":{"vscode":{"settings":{"r.rterm.linux":"/usr/local/bin/arf","r.bracketedPaste":true},"extensions":["quarto.quarto","REditorSupport.r","ms-python.python","ms-toolsai.jupyter"]}}}]' +LABEL devcontainer.metadata='[{"customizations":{"vscode":{"extensions":["quarto.quarto","REditorSupport.r","ms-python.python","ms-toolsai.jupyter"]}}}]' RUN R -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org/'); pak::pak('geocompx/geocompkg', upgrade = TRUE)" -# Install arf — Alternative R Frontend (https://github.com/eitsupi/arf) -RUN export ARF_CONSOLE_INSTALL_DIR=/usr/local ARF_CONSOLE_NO_MODIFY_PATH=1 \ - && wget -qO /tmp/arf-installer.sh https://github.com/eitsupi/arf/releases/download/v0.3.4/arf-console-installer.sh \ - && sh /tmp/arf-installer.sh \ - && rm /tmp/arf-installer.sh # Update quarto to latest stable version: RUN /rocker_scripts/install_quarto.sh ${QUARTO_VERSION} # Set RStudio preferences @@ -21,5 +16,3 @@ RUN echo '{' >> /etc/rstudio/rstudio-prefs.json RUN echo ' "rmd_chunk_output_inline": false' >> /etc/rstudio/rstudio-prefs.json RUN echo '}' >> /etc/rstudio/rstudio-prefs.json -# System-wide shell alias to make 'R' run 'arf' in interactive shells -RUN echo "alias R=arf" >> /etc/bash.bashrc diff --git a/osgeo/Dockerfile b/osgeo/Dockerfile index 85dc0f5..8f3a7f5 100644 --- a/osgeo/Dockerfile +++ b/osgeo/Dockerfile @@ -1,14 +1,5 @@ FROM rocker/geospatial:dev-osgeo RUN R -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org/'); pak::pak('geocompx/geocompkg', upgrade = TRUE)" -# Install arf — Alternative R Frontend (https://github.com/eitsupi/arf) -RUN export ARF_CONSOLE_INSTALL_DIR=/usr/local ARF_CONSOLE_NO_MODIFY_PATH=1 \ - && wget -qO /tmp/arf-installer.sh https://github.com/eitsupi/arf/releases/download/v0.3.4/arf-console-installer.sh \ - && sh /tmp/arf-installer.sh \ - && rm /tmp/arf-installer.sh - -# Ship editor defaults with the image so downstream Codespaces/devcontainers -# inherit VS Code R support even when they only reference the published image. -LABEL devcontainer.metadata='[{"customizations":{"vscode":{"settings":{"r.rterm.linux":"/usr/local/bin/arf","r.bracketedPaste":true},"extensions":["quarto.quarto","REditorSupport.r","ms-python.python","ms-toolsai.jupyter"]}}}]' # Set RStudio preferences # No inline code: @@ -16,5 +7,3 @@ RUN echo '{' >> /etc/rstudio/rstudio-prefs.json RUN echo ' "rmd_chunk_output_inline": false' >> /etc/rstudio/rstudio-prefs.json RUN echo '}' >> /etc/rstudio/rstudio-prefs.json -# System-wide shell alias to make 'R' run 'arf' in interactive shells -RUN echo "alias R=arf" >> /etc/bash.bashrc diff --git a/pythonr/Dockerfile b/pythonr/Dockerfile index c437375..6ede3af 100644 --- a/pythonr/Dockerfile +++ b/pythonr/Dockerfile @@ -1,7 +1,5 @@ FROM ghcr.io/geocompx/python -LABEL devcontainer.metadata='[{"customizations":{"vscode":{"settings":{"r.rterm.linux":"/usr/local/bin/arf","r.bracketedPaste":true},"extensions":["quarto.quarto","REditorSupport.r","ms-python.python","ms-toolsai.jupyter"]}}}]' - # Note: previously this image built on Rocker but install_R_ppa.sh fails on Debian RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ @@ -9,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils \ && rm -rf /var/lib/apt/lists/* # Manual R installation: Download and install R DEB for Debian 12 -ARG R_VERSION=4.5.1 +ARG R_VERSION=4.6.0 RUN curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb && \ apt-get update && \ apt-get install -y --no-install-recommends ./r-${R_VERSION}_1_$(dpkg --print-architecture).deb && \ @@ -19,12 +17,6 @@ ENV PATH="/opt/R/${R_VERSION}/bin:${PATH}" ENV R_PKG_TYPE=binary ENV RETICULATE_PYTHON="/usr/local/bin/python" -# Install arf — Alternative R Frontend (https://github.com/eitsupi/arf) -RUN export ARF_CONSOLE_INSTALL_DIR=/usr/local ARF_CONSOLE_NO_MODIFY_PATH=1 \ - && wget -qO /tmp/arf-installer.sh https://github.com/eitsupi/arf/releases/download/v0.3.4/arf-console-installer.sh \ - && sh /tmp/arf-installer.sh \ - && rm /tmp/arf-installer.sh - RUN mkdir -p /etc/R && \ echo "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest'))" > /etc/R/Rprofile.site && \ mkdir -p /root && \ @@ -45,5 +37,3 @@ RUN R -e "install.packages('geocompkg', repos = c('https://geocompx.r-universe.d # rm main.zip # RUN Rscript -e 'bookdown::render_book("geocompr", output_format = "bookdown::gitbook", clean = FALSE)' -# System-wide shell alias to make 'R' run 'arf' in interactive shells -RUN echo "alias R=arf" >> /etc/bash.bashrc diff --git a/qgis/Dockerfile b/qgis/Dockerfile index a16c21d..9fba338 100644 --- a/qgis/Dockerfile +++ b/qgis/Dockerfile @@ -46,36 +46,24 @@ RUN gpg --no-default-keyring --keyring /etc/apt/keyrings/ubuntugis-unstable-arch RUN wget -qO /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg # RUN sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntugis-ltr `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list' RUN apt-get update && apt-get -y --with-new-pkgs upgrade -RUN apt-get install -y --no-install-recommends qgis grass qgis-plugin-grass saga - -RUN mkdir -p /home/rstudio/.local/share/QGIS/QGIS3/profiles/default/python/plugins \ - && wget -qO sagang_plugin.zip https://github.com/north-road/qgis-processing-saga-nextgen/archive/refs/heads/master.zip \ - && unzip -q sagang_plugin.zip -d /home/rstudio/.local/share/QGIS/QGIS3/profiles/default/python/plugins \ - && mv /home/rstudio/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis-processing-saga-nextgen-master /home/rstudio/.local/share/QGIS/QGIS3/profiles/default/python/plugins/processing_saga_nextgen \ - && rm sagang_plugin.zip - -# Outdated: install SAGA next generation plugin with the qgis-plugin-manager ########################################### -# RUN qgis-plugin-manager init -# RUN qgis-plugin-manager update -# install SAGA next generation plugin -# RUN qgis-plugin-manager install 'Processing Saga NextGen Provider' +RUN apt-get install -y --no-install-recommends qgis grass qgis-plugin-grass # the rest is nice to have but not really necessary # RUN qgis_process in a headless state # ENV QT_QPA_PLATFORM=offscreen # enable desired plugins -# RUN qgis_process plugins enable processing_saga_nextgen # RUN qgis_process plugins enable grassprovider USER root # install R packages ################################################################################################## +# Step 1: Compile key spatial C/C++ packages from source so they link against +# the ubuntugis-unstable GDAL/PROJ/GEOS libraries (no CRAN binary available) +RUN R -e "install.packages(c('sf', 'terra', 'stars', 'lwgeom'), repos = c(CRAN = 'https://cloud.r-project.org'), type = 'source')" +# Step 2: Install everything else from RSPM binaries via pak +RUN R -e "install.packages('pak', repos = 'https://cloud.r-project.org'); pak::pak('geocompx/geocompkg', upgrade = TRUE)" # Set the options() for R users: RUN echo 'options(repos = "https://packagemanager.posit.co/cran/latest")' >> /usr/local/lib/R/etc/Rprofile.site -RUN Rscript -e "install.packages('pak', repos = 'https://cloud.r-project.org/')" -# RUN Rscript -e "pak::pak('r-spatial/sf')" -# RUN Rscript -e "pak::pak('rspatial/terra')" -RUN R -e "install.packages('geocompkg', upgrade = TRUE, dependencies = TRUE, force = TRUE, repos = c('https://geocompx.r-universe.dev', 'https://mlr-org.r-universe.dev', options('repos')))"