Skip to content

Commit

Permalink
add a posit user to the base content container
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
colearendt committed Jul 24, 2023
1 parent 3dc5e2f commit d0c2405
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
18 changes: 14 additions & 4 deletions content/base/Dockerfile.ubuntu1804
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
19 changes: 15 additions & 4 deletions content/base/Dockerfile.ubuntu2204
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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} \
Expand All @@ -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

0 comments on commit d0c2405

Please sign in to comment.