-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor bk-config.sh for improved dependency installation #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7075830
Refactor bk-config.sh for improved dependency installation
ColinFay f2439ad
Clean up comments and enhance error handling
ColinFay bcd3124
Change script execution from sh to bash
ColinFay b327fec
handling cases where the sh is not executed by bash
ColinFay e2fd524
Correct install of NodeJs
ColinFay b52a470
Potential fix for pull request finding
ColinFay 45c376d
Potential fix for pull request finding
ColinFay 8a69166
Fix CI installs: move GitHub-only pkgs off CRAN and use rstudio/bsicons
ColinFay 1a6b8ce
CI: add apt retries/timeouts in bk-config.sh to reduce flaky mirror f…
ColinFay ba7da4c
first Claude optim
ColinFay b63da60
Merge remote-tracking branch 'origin/master' into ColinFay-patch-1
Copilot c16bdf3
removed unused package and wrapped remove
ColinFay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,94 +1,137 @@ | ||
| #!/bin/bash | ||
| # bk-config.sh — pour rocker/geospatial:latest (Ubuntu noble 24.04) | ||
| # | ||
| # Liste des paquets calibrée sur le contenu réel de geospatial:latest : | ||
| # tout ce qui est déjà fourni par l'image (libgdal-dev, libcairo2-dev, | ||
| # libsqlite3-dev, pandoc, etc.) a été retiré pour réduire le bruit. | ||
| # Si l'image change, certains paquets peuvent revenir manquants — c'est | ||
| # alors apt qui te le dira au build. | ||
| # | ||
| # Optimisations : | ||
| # - Détection automatique d'Azure (via wget car curl n'est pas dans | ||
| # geospatial:latest) → mirror azure.archive.ubuntu.com | ||
| # - Un seul apt-get update + un seul apt-get install consolidé | ||
|
|
||
| # Spatial stuff | ||
| apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| lbzip2 \ | ||
| libfftw3-dev \ | ||
| libgdal-dev \ | ||
| libgeos-dev \ | ||
| libudunits2-dev \ | ||
| libnode-dev \ | ||
| libcairo2-dev \ | ||
| libgsl0-dev \ | ||
| libgl1-mesa-dev \ | ||
| libglu1-mesa-dev \ | ||
| libhdf4-alt-dev \ | ||
| libhdf5-dev \ | ||
| libfribidi-dev \ | ||
| libharfbuzz-dev \ | ||
| libmagick++-dev \ | ||
| libjq-dev \ | ||
| libpq-dev \ | ||
| libproj-dev \ | ||
| libprotobuf-dev \ | ||
| libnetcdf-dev \ | ||
| libsqlite3-dev \ | ||
| libssl-dev \ | ||
| libudunits2-dev \ | ||
| netcdf-bin \ | ||
| postgis \ | ||
| protobuf-compiler \ | ||
| sqlite3 \ | ||
| tk-dev \ | ||
| unixodbc-dev \ | ||
| imagemagick \ | ||
| libsecret-1-dev | ||
|
|
||
| apt-get install -y \ | ||
| libmagick++-dev \ | ||
| libjq-dev \ | ||
| libv8-dev \ | ||
| libprotobuf-dev \ | ||
| protobuf-compiler \ | ||
| libsodium-dev \ | ||
| imagemagick \ | ||
| libgit2-dev \ | ||
| xclip | ||
|
|
||
| # database ---- | ||
| apt-get update \ | ||
| apt-get install -y --no-install-recommends \ | ||
| if [ -z "${BASH_VERSION:-}" ]; then | ||
| if command -v bash >/dev/null 2>&1; then | ||
| exec bash "$0" "$@" | ||
| fi | ||
| echo "ERROR: bk-config.sh doit être exécuté avec bash" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| set -euo pipefail | ||
| trap 'echo "ERROR: bk-config.sh a échoué à la ligne $LINENO" >&2' ERR | ||
|
|
||
| export DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Détection Azure via IMDS. Utilise wget (présent dans rocker) car curl ne | ||
| # l'est pas. Le header `Metadata: true` + le path `/metadata/instance` sont | ||
| # spécifiques à Azure : ne matchera pas par accident sur AWS/GCP qui ont | ||
| # leurs propres endpoints au même 169.254.169.254 mais avec d'autres specs. | ||
| # Override possible via APT_MIRROR=azure / APT_MIRROR=default. | ||
| # --------------------------------------------------------------------------- | ||
| USE_AZURE_MIRROR=0 | ||
|
|
||
| azure_imds_check() { | ||
| if command -v curl >/dev/null 2>&1; then | ||
| curl -fsS -m 2 -H "Metadata:true" \ | ||
| "http://169.254.169.254/metadata/instance?api-version=2021-02-01" \ | ||
| >/dev/null 2>&1 | ||
| elif command -v wget >/dev/null 2>&1; then | ||
| wget -q --timeout=2 --tries=1 \ | ||
| --header='Metadata: true' \ | ||
| -O /dev/null \ | ||
| "http://169.254.169.254/metadata/instance?api-version=2021-02-01" \ | ||
| 2>/dev/null | ||
| else | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| case "${APT_MIRROR:-auto}" in | ||
| azure) USE_AZURE_MIRROR=1 ;; | ||
| default) USE_AZURE_MIRROR=0 ;; | ||
| auto) | ||
| if azure_imds_check; then | ||
| USE_AZURE_MIRROR=1 | ||
| fi | ||
| ;; | ||
| esac | ||
|
|
||
| if [ "$USE_AZURE_MIRROR" = "1" ]; then | ||
| echo "Azure detected — switching APT sources to azure.archive.ubuntu.com" | ||
| # Sur noble, les sources sont en deb822 (.sources). On gère les deux | ||
| # formats au cas où. | ||
| for f in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do | ||
| if [ -f "$f" ]; then | ||
| sed -i \ | ||
| -e 's|http://archive\.ubuntu\.com/ubuntu/\?|http://azure.archive.ubuntu.com/ubuntu/|g' \ | ||
| -e 's|http://security\.ubuntu\.com/ubuntu/\?|http://azure.archive.ubuntu.com/ubuntu/|g' \ | ||
| "$f" | ||
| fi | ||
| done | ||
| else | ||
| echo "Non-Azure environment — keeping default APT mirrors" | ||
| fi | ||
|
|
||
| APT_GET="apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30" | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Liste réduite : uniquement ce qui MANQUE dans geospatial:latest. | ||
| # | ||
| # Ce qui est déjà dans l'image (et donc retiré) : | ||
| # ca-certificates, libcairo2-dev, libfftw3-dev, libfribidi-dev, | ||
| # libgdal-dev, libgeos-dev, libgit2-dev, libgl1-mesa-dev, libglu1-mesa-dev, | ||
| # libgsl-dev, libharfbuzz-dev, libhdf5-dev, libjq-dev, libnetcdf-dev, | ||
| # libnss3, libpq-dev, libproj-dev, libprotobuf-dev, libsqlite3-dev, | ||
| # libssl-dev, libudunits2-dev, libxrender1, netcdf-bin, pandoc, postgis, | ||
| # protobuf-compiler, sqlite3, tk-dev, tzdata, unixodbc-dev, | ||
| # default-libmysqlclient-dev. | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| $APT_GET update | ||
|
|
||
| $APT_GET install -y --no-install-recommends \ | ||
| cron \ | ||
| curl \ | ||
| default-mysql-client \ | ||
| default-libmysqlclient-dev | ||
|
|
||
| # Divers | ||
| apt-get install -y r-cran-rjava cron nano | ||
|
|
||
| # Locals | ||
| apt-get install -y tzdata | ||
| apt-get install -y language-pack-fr | ||
| mv /etc/localtime /etc/localtime_backup \ | ||
| && ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime \ | ||
| && dpkg-reconfigure -f noninteractive tzdata | ||
|
|
||
|
|
||
| # Chromium for {pagedown} ---- | ||
|
|
||
| apt-get update | ||
|
|
||
| # TODO these libs are here | ||
| # as they were historically installed for Chrome, | ||
| # but I'm not sure if they are needed anymore, can we remove them? | ||
| apt-get -y install libxpm4 \ | ||
| libxrender1 \ | ||
| libgtk2.0-0 \ | ||
| libnss3 \ | ||
| libgconf-2-4 \ | ||
| xvfb \ | ||
| gtk2-engines-pixbuf \ | ||
| xfonts-cyrillic \ | ||
| xfonts-100dpi \ | ||
| xfonts-75dpi \ | ||
| xfonts-base \ | ||
| xfonts-scalable | ||
|
|
||
| curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
| apt-get install -y ./google-chrome-stable_current_amd64.deb | ||
| rm google-chrome-stable_current_amd64.deb | ||
|
|
||
| # NodeJS | ||
|
|
||
| apt-get -y install curl gnupg && \ | ||
| curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ | ||
| apt-get -y --allow-unauthenticated install nodejs | ||
| imagemagick \ | ||
| language-pack-fr \ | ||
| libmagick++-dev \ | ||
| libnode-dev \ | ||
| libsecret-1-dev \ | ||
| libsodium-dev \ | ||
| libxpm4 \ | ||
| nano \ | ||
| nodejs \ | ||
| r-cran-rjava \ | ||
| xclip \ | ||
| xfonts-100dpi \ | ||
| xfonts-75dpi \ | ||
| xfonts-base \ | ||
| xfonts-cyrillic \ | ||
| xfonts-scalable \ | ||
| xvfb | ||
|
|
||
| # Timezone Europe/Paris (idempotent : -f force, -n no-deref) | ||
| ln -fsn /usr/share/zoneinfo/Europe/Paris /etc/localtime | ||
| dpkg-reconfigure -f noninteractive tzdata | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Chrome (pour {pagedown}). Le .deb déclare ses dépendances ; apt résout | ||
| # automatiquement ce qui manque (libgbm1, libxkbcommon0, etc.). | ||
| # --------------------------------------------------------------------------- | ||
| curl -fsSL --retry 3 --retry-connrefused \ | ||
| -o /tmp/google-chrome-stable_current_amd64.deb \ | ||
| https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
|
|
||
| $APT_GET install -y --no-install-recommends \ | ||
| /tmp/google-chrome-stable_current_amd64.deb | ||
|
|
||
| rm /tmp/google-chrome-stable_current_amd64.deb | ||
|
|
||
| # Cleanup | ||
| $APT_GET clean | ||
| rm -rf /var/lib/apt/lists/* | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.