From d0c240520d77c7c2752f027e010ad6c6f4958943 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Tue, 14 Feb 2023 15:02:16 -0500 Subject: [PATCH] add a posit user to the base content container When service accounts are in play, they default to UID/GID 999. For instance, on Connect. We create a posit user in this place for consistency across products, environments, etc. --- content/base/Dockerfile.ubuntu1804 | 18 ++++++++++++++---- content/base/Dockerfile.ubuntu2204 | 19 +++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/content/base/Dockerfile.ubuntu1804 b/content/base/Dockerfile.ubuntu1804 index c53d4485..588575ce 100644 --- a/content/base/Dockerfile.ubuntu1804 +++ b/content/base/Dockerfile.ubuntu1804 @@ -26,7 +26,7 @@ RUN apt-get update \ # System dependencies needed by popular R packages # https://docs.rstudio.com/rsc/post-setup-tool/#install-system-dependencies -# Now, install the system requirements for R packages. +# Now, install the system requirements for R and Python packages. RUN apt-get update \ && apt-get install -y --no-install-recommends \ default-jdk \ @@ -90,7 +90,7 @@ RUN apt-get update \ # Reference: https://docs.rstudio.com/resources/install-r/ -# We are NOT linking one of these R versions into the PATH. +# The version of R is NOT added to the PATH ARG R_DISTRIBUTION=ubuntu-1804 @@ -107,7 +107,7 @@ RUN curl -fsSL -O https://cdn.rstudio.com/r/${R_DISTRIBUTION}/pkgs/${R_INSTALLER # Reference: https://docs.rstudio.com/resources/install-python/ -# We are NOT linking one of these Python versions into the PATH. +# This version of python is NOT added to the PATH ARG MINICONDA_VERSION=4.7.12.1 ARG PYTHON_VERSION=3.7.6 @@ -124,9 +124,19 @@ RUN curl -fsSL -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-${ # remove miniconda too, for size && rm -rf /opt/miniconda -# install quarto +# Install Quarto --------------------------------------------------------------# + +# Reference: https://docs.posit.co/resources/install-quarto/ + +# This version of quarto is NOT added to the PATH + ARG QUARTO_VERSION=1.0.37 COPY maybe_install_quarto.sh /tmp/maybe_install_quarto.sh RUN /opt/R/${R_VERSION}/bin/R -e 'install.packages("odbc", repos="https://packagemanager.rstudio.com/cran/__linux__/bionic/latest")' \ && /tmp/maybe_install_quarto.sh \ && rm -f /tmp/maybe_install_quarto.sh + +# Add a posit user / group --------------------------------------------------------------# + +RUN groupadd -g 999 -r posit && \ + useradd -r -u 999 -g 999 -M posit diff --git a/content/base/Dockerfile.ubuntu2204 b/content/base/Dockerfile.ubuntu2204 index 030eab0b..8ce7ec26 100644 --- a/content/base/Dockerfile.ubuntu2204 +++ b/content/base/Dockerfile.ubuntu2204 @@ -33,7 +33,7 @@ RUN apt-get update \ # System dependencies needed by popular R packages # https://docs.rstudio.com/rsc/post-setup-tool/#install-system-dependencies -# Now, install the system requirements for R packages. +# Now, install the system requirements for R and Python packages. RUN apt-get update \ && apt-get install -y --no-install-recommends \ default-jdk \ @@ -97,7 +97,8 @@ RUN apt-get update \ # Reference: https://docs.rstudio.com/resources/install-r/ -# We are NOT linking one of these R versions into the PATH. +# The version of R is NOT added to the PATH + RUN curl -fsSL -O https://cdn.rstudio.com/r/${DISTRIBUTION}/pkgs/${R_INSTALLER} \ && apt-get update \ && apt-get install -f -y --no-install-recommends ./${R_INSTALLER} \ @@ -109,16 +110,26 @@ RUN curl -fsSL -O https://cdn.rstudio.com/r/${DISTRIBUTION}/pkgs/${R_INSTALLER} # Reference: https://docs.rstudio.com/resources/install-python/ -# We are NOT linking one of these Python versions into the PATH. +# This version of python is NOT added to the PATH RUN curl -O https://cdn.rstudio.com/python/${DISTRIBUTION}/pkgs/python-${PYTHON_VERSION}_1_amd64.deb \ && apt-get install -yq --no-install-recommends ./python-${PYTHON_VERSION}_1_amd64.deb \ && rm -rf python-${PYTHON_VERSION}_1_amd64.deb \ && /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install --upgrade setuptools -# install quarto +# Install Quarto --------------------------------------------------------------# + +# Reference: https://docs.posit.co/resources/install-quarto/ + +# This version of quarto is NOT added to the PATH + ARG QUARTO_VERSION=1.3.340 COPY maybe_install_quarto.sh /tmp/maybe_install_quarto.sh RUN /opt/R/${R_VERSION}/bin/R -e 'install.packages("odbc", repos="https://packagemanager.rstudio.com/cran/__linux__/bionic/latest")' \ && /tmp/maybe_install_quarto.sh \ && rm -f /tmp/maybe_install_quarto.sh + +# Add a posit user / group --------------------------------------------------------------# + +RUN groupadd -g 999 -r posit && \ + useradd -r -u 999 -g 999 -M posit