Skip to content

Commit

Permalink
Refactor 'R latest' Dev Container
Browse files Browse the repository at this point in the history
  • Loading branch information
benz0li committed Mar 10, 2024
1 parent 53da499 commit 08a6809
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

!/.gitignore
!/devcontainer.json
!/Dockerfile
!/R.Dockerfile
!/LICENSE
!/README.md
13 changes: 8 additions & 5 deletions .devcontainer/Dockerfile → .devcontainer/R.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
ARG BUILD_ON_IMAGE=glcr.b-data.ch/r/tidyverse
ARG R_VERSION=latest

FROM docker.io/koalaman/shellcheck:stable as sci

FROM ${BUILD_ON_IMAGE}:${R_VERSION} as files

RUN mkdir /files

COPY conf/shell /files
COPY scripts /files

## Ensure file modes are correct
## Ensure file modes are correct
RUN find /files -type d -exec chmod 755 {} \; \
&& find /files -type f -exec chmod 644 {} \; \
&& find /files/usr/local/bin -type f -exec chmod 755 {} \; \
&& cp -r /files/etc/skel/. /files/root \
&& bash -c 'rm -rf /files/root/{.bashrc,.profile}' \
&& chmod 700 /files/root

FROM docker.io/koalaman/shellcheck:stable as sci

FROM ${BUILD_ON_IMAGE}:${R_VERSION}

ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -33,6 +33,9 @@ ENV PARENT_IMAGE=${BUILD_ON_IMAGE}:${R_VERSION} \
CRAN=${CRAN_OVERRIDE:-$CRAN} \
PARENT_IMAGE_BUILD_DATE=${BUILD_DATE}

# Dev Container
ARG NCPUS

# hadolint ignore=DL3008,DL3015,SC2016
RUN dpkgArch="$(dpkg --print-architecture)" \
## Ensure that common CA certificates
Expand All @@ -48,7 +51,7 @@ RUN dpkgArch="$(dpkg --print-architecture)" \
&& install2.r -r "https://r-lib.github.io/p/pak/stable/$pkgType/$os/$arch" -e \
pak \
## Install languageserver and decor
&& install2.r -s -d TRUE -n "$(($(nproc)+1))" -e \
&& install2.r -s -d TRUE -n "${NCPUS:-$(($(nproc)+1))}" -e \
languageserver \
decor \
## Clean up
Expand All @@ -71,7 +74,7 @@ RUN dpkgArch="$(dpkg --print-architecture)" \
## Clean up
&& rm -rf /var/lib/apt/lists/*

## Update environment
# Update environment
ARG USE_ZSH_FOR_ROOT
ARG SET_LANG
ARG SET_TZ
Expand Down
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "R latest",
"name": "R latest (Debian stable)",
"build": {
"dockerfile": "Dockerfile",
"args": {
"BUILD_ON_IMAGE": "glcr.b-data.ch/r/tidyverse",
"CRAN": "https://cloud.r-project.org",
"R_VERSION": "latest",
// "NCPUS": "1",
"USE_ZSH_FOR_ROOT": "unset-to-use-bash",
"SET_LANG": "en_US.UTF-8",
"SET_TZ": "Etc/UTC"
Expand All @@ -29,7 +30,7 @@
},
// A comma separated list of packages to install
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "qpdf"
"packages": "libcairo2-dev,libtiff-dev,qpdf"
}
},

Expand Down

0 comments on commit 08a6809

Please sign in to comment.