diff --git a/README.Rmd b/README.Rmd index 7b4c58f..6b9ed06 100644 --- a/README.Rmd +++ b/README.Rmd @@ -9,11 +9,36 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) + +imgs = readr::read_csv("image-info.csv", show_col_types = FALSE) + +get_ghcr_downloads = function(pkg) { + url = paste0("https://github.com/orgs/geocompx/packages/container/package/", pkg) + html = tryCatch(paste(readLines(url, warn = FALSE), collapse = " "), error = function(e) "") + m = regexec('Total downloads\\s*

([^<]+)

', html) + hit = regmatches(html, m)[[1]] + if (length(hit) >= 3) { + list(count = as.numeric(hit[2]), label = hit[3]) + } else { + list(count = NA_real_, label = "?") + } +} + +dl_info = lapply(imgs$image_name, get_ghcr_downloads) +imgs$downloads_num = vapply(dl_info, `[[`, numeric(1), "count") +imgs$Downloads = vapply(dl_info, `[[`, character(1), "label") +total_downloads = sum(imgs$downloads_num, na.rm = TRUE) +total_downloads_label = if (total_downloads >= 1000) { + paste0(round(total_downloads / 1000, 1), "k") +} else { + as.character(total_downloads) +} ``` # Geocomputation with Docker -[![](https://img.shields.io/docker/pulls/geocompx/docker?style=plastic)](https://github.com/geocompx/docker/blob/master/) +[![CI/CD](https://github.com/geocompx/docker/actions/workflows/ci.yml/badge.svg)](https://github.com/geocompx/docker/actions/workflows/ci.yml) +[![GHCR Downloads](https://img.shields.io/badge/GHCR_downloads-`r total_downloads_label`-blue?style=plastic&logo=github)](https://github.com/orgs/geocompx/packages?repo_name=docker) This repo provides Docker images for geographic research and reproducing code from the books *Geocomputation with R* and *Geocomputation with Python*, building on the [Rocker Project](https://www.rocker-project.org/). @@ -44,17 +69,16 @@ The R-enabled images (`latest`, `minimal`, `osgeo`, `pythonr`) support VS Code D The base image is `rocker/geospatial` from [rocker-versioned2](https://github.com/rocker-org/rocker-versioned2). We provide variants with different package sets and library versions: ```{r, include=FALSE} -imgs = readr::read_csv("image-info.csv") imgs <- imgs[order(imgs$size), ] -imgs$Image = paste0("[", imgs$image_name, "](https://ghcr.io/geocompx/", imgs$image_name, ":latest)") +imgs$Image = paste0("[", imgs$image_name, "](https://github.com/geocompx/docker/pkgs/container/", imgs$image_name, ")") imgs$Command = paste0("[", imgs$command, "](https://github.com/geocompx/docker/blob/master/", ifelse(imgs$image_name == "latest", "Dockerfile", paste0(imgs$image_name, "/Dockerfile")), ")") -imgs <- imgs[, c("Image", "Command", "size", "description")] -names(imgs) = c("Image", "Command", "Size", "Description") +imgs <- imgs[, c("Image", "Command", "size", "Downloads", "description")] +names(imgs) = c("Image", "Command", "Size", "Downloads", "Description") ``` ```{r, echo=FALSE} -knitr::kable(imgs) +knitr::kable(imgs, row.names = FALSE) ``` Add `:tagname` after `ghcr.io/geocompx/` for a specific version (see [packages](https://github.com/geocompx/docker/pkgs/container/minimal)). diff --git a/README.md b/README.md index 2274205..4f9d08a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ + # Geocomputation with Docker -[![](https://img.shields.io/docker/pulls/geocompx/docker?style=plastic)](https://github.com/geocompx/docker/blob/master/) +[![CI/CD](https://github.com/geocompx/docker/actions/workflows/ci.yml/badge.svg)](https://github.com/geocompx/docker/actions/workflows/ci.yml) +[![GHCR +Downloads](https://img.shields.io/badge/GHCR_downloads-43k-blue?style=plastic&logo=github)](https://github.com/orgs/geocompx/packages?repo_name=docker) This repo provides Docker images for geographic research and reproducing code from the books *Geocomputation with R* and *Geocomputation with @@ -40,20 +43,20 @@ The base image is `rocker/geospatial` from [rocker-versioned2](https://github.com/rocker-org/rocker-versioned2). We provide variants with different package sets and library versions: -| Image | Command | Size | Description | -|:---|:---|:---|:---| -| [minimal-slim](https://ghcr.io/geocompx/minimal-slim:latest) | [docker pull ghcr.io/geocompx/minimal-slim](https://github.com/geocompx/docker/blob/master/minimal-slim/Dockerfile) | ? | Slim R + geospatial without RStudio | -| [python](https://ghcr.io/geocompx/python:latest) | [docker pull ghcr.io/geocompx/python](https://github.com/geocompx/docker/blob/master/python/Dockerfile) | 2.32GB | Python + geospatial libraries | -| [pythonr](https://ghcr.io/geocompx/pythonr:latest) | [docker pull ghcr.io/geocompx/pythonr](https://github.com/geocompx/docker/blob/master/pythonr/Dockerfile) | 4.37GB | Python + R + geospatial libraries | -| [minimal](https://ghcr.io/geocompx/minimal:latest) | [docker pull ghcr.io/geocompx/minimal](https://github.com/geocompx/docker/blob/master/minimal/Dockerfile) | 5.43GB | Lightweight R + core geospatial libs | -| [suggests](https://ghcr.io/geocompx/suggests:latest) | [docker pull ghcr.io/geocompx/suggests](https://github.com/geocompx/docker/blob/master/suggests/Dockerfile) | 5.67GB | Full R dependencies for geocompx | -| [latest](https://ghcr.io/geocompx/latest:latest) | [docker pull ghcr.io/geocompx/latest](https://github.com/geocompx/docker/blob/master/Dockerfile) | 5.70GB | Default full geocompx environment | -| [osgeo](https://ghcr.io/geocompx/osgeo:latest) | [docker pull ghcr.io/geocompx/osgeo](https://github.com/geocompx/docker/blob/master/osgeo/Dockerfile) | 6.07GB | R with latest OSGeo GDAL/PROJ/GEOS | -| [buildbook](https://ghcr.io/geocompx/buildbook:latest) | [docker pull ghcr.io/geocompx/buildbook](https://github.com/geocompx/docker/blob/master/buildbook/Dockerfile) | 6.44GB | Pre-configured book build environment | -| [rocker-rpy](https://ghcr.io/geocompx/rocker-rpy:latest) | [docker pull ghcr.io/geocompx/rocker-rpy](https://github.com/geocompx/docker/blob/master/rocker-rpy/Dockerfile) | 6.46GB | R + Python scientific stack | -| [rust](https://ghcr.io/geocompx/rust:latest) | [docker pull ghcr.io/geocompx/rust](https://github.com/geocompx/docker/blob/master/rust/Dockerfile) | 7.63GB | R + Rust toolchain | -| [rocker-rpyjl](https://ghcr.io/geocompx/rocker-rpyjl:latest) | [docker pull ghcr.io/geocompx/rocker-rpyjl](https://github.com/geocompx/docker/blob/master/rocker-rpyjl/Dockerfile) | 7.68GB | R + Python + Julia multi-language | -| [qgis](https://ghcr.io/geocompx/qgis:latest) | [docker pull ghcr.io/geocompx/qgis](https://github.com/geocompx/docker/blob/master/qgis/Dockerfile) | 8.63GB | QGIS desktop GIS environment | +| Image | Command | Size | Downloads | Description | +|:---|:---|:---|:---|:---| +| [minimal-slim](https://github.com/geocompx/docker/pkgs/container/minimal-slim) | [docker pull ghcr.io/geocompx/minimal-slim](https://github.com/geocompx/docker/blob/master/minimal-slim/Dockerfile) | ? | 212 | Slim R + geospatial without RStudio | +| [python](https://github.com/geocompx/docker/pkgs/container/python) | [docker pull ghcr.io/geocompx/python](https://github.com/geocompx/docker/blob/master/python/Dockerfile) | 2.32GB | 4.05K | Python + geospatial libraries | +| [pythonr](https://github.com/geocompx/docker/pkgs/container/pythonr) | [docker pull ghcr.io/geocompx/pythonr](https://github.com/geocompx/docker/blob/master/pythonr/Dockerfile) | 4.37GB | 1.76K | Python + R + geospatial libraries | +| [minimal](https://github.com/geocompx/docker/pkgs/container/minimal) | [docker pull ghcr.io/geocompx/minimal](https://github.com/geocompx/docker/blob/master/minimal/Dockerfile) | 5.43GB | 6.08K | Lightweight R + core geospatial libs | +| [suggests](https://github.com/geocompx/docker/pkgs/container/suggests) | [docker pull ghcr.io/geocompx/suggests](https://github.com/geocompx/docker/blob/master/suggests/Dockerfile) | 5.67GB | 5.43K | Full R dependencies for geocompx | +| [latest](https://github.com/geocompx/docker/pkgs/container/latest) | [docker pull ghcr.io/geocompx/latest](https://github.com/geocompx/docker/blob/master/Dockerfile) | 5.70GB | 4.2K | Default full geocompx environment | +| [osgeo](https://github.com/geocompx/docker/pkgs/container/osgeo) | [docker pull ghcr.io/geocompx/osgeo](https://github.com/geocompx/docker/blob/master/osgeo/Dockerfile) | 6.07GB | 3.49K | R with latest OSGeo GDAL/PROJ/GEOS | +| [buildbook](https://github.com/geocompx/docker/pkgs/container/buildbook) | [docker pull ghcr.io/geocompx/buildbook](https://github.com/geocompx/docker/blob/master/buildbook/Dockerfile) | 6.44GB | 2.58K | Pre-configured book build environment | +| [rocker-rpy](https://github.com/geocompx/docker/pkgs/container/rocker-rpy) | [docker pull ghcr.io/geocompx/rocker-rpy](https://github.com/geocompx/docker/blob/master/rocker-rpy/Dockerfile) | 6.46GB | 4K | R + Python scientific stack | +| [rust](https://github.com/geocompx/docker/pkgs/container/rust) | [docker pull ghcr.io/geocompx/rust](https://github.com/geocompx/docker/blob/master/rust/Dockerfile) | 7.63GB | 4.18K | R + Rust toolchain | +| [rocker-rpyjl](https://github.com/geocompx/docker/pkgs/container/rocker-rpyjl) | [docker pull ghcr.io/geocompx/rocker-rpyjl](https://github.com/geocompx/docker/blob/master/rocker-rpyjl/Dockerfile) | 7.68GB | 2.82K | R + Python + Julia multi-language | +| [qgis](https://github.com/geocompx/docker/pkgs/container/qgis) | [docker pull ghcr.io/geocompx/qgis](https://github.com/geocompx/docker/blob/master/qgis/Dockerfile) | 8.63GB | 4.14K | QGIS desktop GIS environment | Add `:tagname` after `ghcr.io/geocompx/` for a specific version (see @@ -77,11 +80,16 @@ RUN install2.r sf terra spData Available rocker-versioned2 scripts: -- [`install_geospatial.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_geospatial.sh) — GDAL, PROJ, GEOS + sf, terra, raster, stars, sp -- [`install_rstudio.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh) — RStudio Server with S6 supervisor -- [`install_python.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_python.sh) — Python 3 + reticulate -- [`install_tidyverse.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_tidyverse.sh) — Tidyverse stack -- [`install_quarto.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_quarto.sh) — Quarto CLI +- [`install_geospatial.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_geospatial.sh) + — GDAL, PROJ, GEOS + sf, terra, raster, stars, sp +- [`install_rstudio.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh) + — RStudio Server with S6 supervisor +- [`install_python.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_python.sh) + — Python 3 + reticulate +- [`install_tidyverse.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_tidyverse.sh) + — Tidyverse stack +- [`install_quarto.sh`](https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_quarto.sh) + — Quarto CLI ## Examples diff --git a/python/Dockerfile b/python/Dockerfile index 1a46faf..844edbf 100644 --- a/python/Dockerfile +++ b/python/Dockerfile @@ -31,11 +31,10 @@ RUN arch="$(dpkg --print-architecture)" \ # Install uv for fast Python package & project management COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/ -# Install requirements +# Install requirements using uv for fast parallel wheel resolution RUN wget -q -O /tmp/requirements.txt https://raw.githubusercontent.com/geocompx/py/main/requirements.txt \ - && python -m pip install --no-cache-dir -r /tmp/requirements.txt \ + && uv pip install --system --no-cache -r /tmp/requirements.txt seaborn openpyxl statsmodels pyarrow \ && rm /tmp/requirements.txt - # Clean up build tools to reduce image size (optional but recommended) RUN apt purge -y build-essential && apt autoremove -y && rm -rf /var/lib/apt/lists/* diff --git a/qgis/Dockerfile b/qgis/Dockerfile index 8eb220e..a1a8c82 100644 --- a/qgis/Dockerfile +++ b/qgis/Dockerfile @@ -2,7 +2,7 @@ FROM rocker/geospatial:dev-osgeo # ARG only sets the ENV var during the build session whereas ENV also keeps it in the containers later on ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get -y --with-new-pkgs upgrade +RUN apt-get -o Acquire::Retries=5 update && apt-get -o Acquire::Retries=5 -y --with-new-pkgs upgrade # # how to install LTR, latest or nightly QGIS version, see: # # https://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu # RUN apt-get -y install gnupg software-properties-common python3-pip @@ -48,8 +48,10 @@ RUN wget -qO /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.or # if we want qgis ltr, we need to run the following line RUN sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu-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 && rm -rf /var/lib/apt/lists/* +RUN apt-get -o Acquire::Retries=5 update && apt-get -o Acquire::Retries=5 -y --with-new-pkgs upgrade +RUN for i in 1 2 3; do \ + apt-get -o Acquire::Retries=5 -o Acquire::https::Pipeline-Depth=0 install -y --no-install-recommends qgis grass qgis-plugin-grass saga && break || sleep 5; \ + done && rm -rf /var/lib/apt/lists/* # the rest is nice to have but not really necessary # RUN qgis_process in a headless state