From fd0af45507478984060e56de71a775594d5ec73a Mon Sep 17 00:00:00 2001 From: Jerred Shepherd Date: Thu, 9 Nov 2023 10:29:38 -0800 Subject: [PATCH] add Python to Package Manager images --- .github/workflows/build-prerelease.yaml | 1 - hadolint.yaml | 2 + package-manager/Dockerfile.ubuntu1804 | 94 ------------------------- package-manager/Dockerfile.ubuntu2204 | 12 +++- 4 files changed, 11 insertions(+), 98 deletions(-) delete mode 100644 package-manager/Dockerfile.ubuntu1804 diff --git a/.github/workflows/build-prerelease.yaml b/.github/workflows/build-prerelease.yaml index fed12d32e..ef895605d 100644 --- a/.github/workflows/build-prerelease.yaml +++ b/.github/workflows/build-prerelease.yaml @@ -30,7 +30,6 @@ jobs: - {product: "workbench", type: "preview", os: "ubuntu2204", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - {product: "connect", type: "daily", os: "ubuntu2204", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - {product: "connect-content-init", type: "daily", os: "ubuntu2204", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - - {product: "package-manager", type: "daily", os: "ubuntu1804", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - {product: "package-manager", type: "daily", os: "ubuntu2204", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - {product: "r-session-complete", type: "daily", os: "ubuntu2204", r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.17", py-alternate: "3.8.17"} - {product: "r-session-complete", type: "daily", os: 'centos7', r-primary: "4.2.3", r-alternate: "4.1.3", py-primary: "3.9.14", py-alternate: "3.8.15"} diff --git a/hadolint.yaml b/hadolint.yaml index 10066a69a..bf071e06c 100644 --- a/hadolint.yaml +++ b/hadolint.yaml @@ -4,6 +4,8 @@ ignored: - DL3008 # Suppresses warning for version pinning on yum installs. We currently do not practice this approach. - DL3033 + # Suppresses warning for version pinning on pip installs. We currently do not practice this approach. + - DL3013 # Suppresses info for too many consecutive RUN statements. Multiple consecutive RUN statements are often a conscious # design choice in our Dockerfiles, but we could consider condensing them in the future. - DL3059 diff --git a/package-manager/Dockerfile.ubuntu1804 b/package-manager/Dockerfile.ubuntu1804 deleted file mode 100644 index 448c3f80c..000000000 --- a/package-manager/Dockerfile.ubuntu1804 +++ /dev/null @@ -1,94 +0,0 @@ -ARG R_VERSION=4.2.3 -FROM rstudio/r-base:${R_VERSION}-bionic -LABEL maintainer="RStudio Docker " - -ARG R_VERSION=4.2.3 - -# Locale configuration --------------------------------------------------------# -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 -ENV STARTUP_DEBUG_MODE 0 -ARG DEBIAN_FRONTEND=noninteractive -ARG TINI_VERSION=0.19.0 - -ENV PATH /opt/rstudio-pm/bin:$PATH - -# Upgrade/install packages ----------------------------------------------------# -RUN apt-get update --fix-missing \ - && apt-get upgrade -yq \ - && apt-get install -yq --no-install-recommends \ - ca-certificates \ - curl \ - dirmngr \ - gpg \ - gpg-agent \ - && rm -rf /var/lib/apt/lists/* - -# Runtime settings ------------------------------------------------------------# -ADD https://cdn.rstudio.com/platform/tini/v${TINI_VERSION}/tini-amd64 /tini -ADD https://cdn.rstudio.com/platform/tini/v${TINI_VERSION}/tini-amd64.asc /tini.asc -# Keys must be pulled using curl, gpg calls intermittently fail on 18.04 with "gpg: keyserver receive failed: Cannot assign requested address" -RUN gpg --update-trustdb \ - && curl -sL -o /tmp/tini-key.asc "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x6380dc428747f6c393feaca59a84159d7001a4e5" \ - && gpg --import /tmp/tini-key.asc \ - && rm /tmp/tini-key.asc \ - && gpg --batch --verify /tini.asc /tini \ - && chmod +x /tini \ - && ln -s /tini /usr/local/bin/tini - -# Add another R version -------------------------------------------------------# -ARG R_VERSION_ALT=4.1.3 -RUN apt-get update -qq && \ - curl -O https://cdn.rstudio.com/r/ubuntu-1804/pkgs/r-${R_VERSION_ALT}_1_amd64.deb && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y ./r-${R_VERSION_ALT}_1_amd64.deb && \ - rm -f ./r-${R_VERSION_ALT}_1_amd64.deb \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Download RStudio Package Manager ---------------------------------------------# -ARG RSPM_VERSION=2023.08.4-20 -ARG RSPM_DOWNLOAD_URL=https://cdn.rstudio.com/package-manager/deb/amd64 -# Keys must be pulled using curl, gpg calls intermittently fail on 18.04 with "gpg: keyserver receive failed: Cannot assign requested address" -RUN apt-get update --fix-missing \ - && apt-get install -y --no-install-recommends gdebi-core gpg dpkg-sig \ - && curl -O ${RSPM_DOWNLOAD_URL}/rstudio-pm_${RSPM_VERSION}_amd64.deb \ - # Pre 7/25/23 packages - && curl -sL -o /tmp/rstudio-key.asc "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xfe8564cff1ab93f1728645193f32ee77e331692f" \ - && gpg --import /tmp/rstudio-key.asc \ - && rm /tmp/rstudio-key.asc \ - # Post 7/25 packages - && curl -sL -o /tmp/posit-key.asc "https://keys.openpgp.org/vks/v1/by-fingerprint/8B65E5A107BBEFE3BA99C59751C0B5BB19F92D60" \ - && gpg --import /tmp/posit-key.asc \ - && rm /tmp/posit-key.asc \ - && dpkg-sig --verify rstudio-pm_${RSPM_VERSION}_amd64.deb \ - && RSTUDIO_INSTALL_NO_LICENSE_INITIALIZATION=1 gdebi -n rstudio-pm_${RSPM_VERSION}_amd64.deb \ - && rm rstudio-pm_${RSPM_VERSION}_amd64.deb \ - && apt-get purge -y gdebi-core dpkg-sig gpg gpg-agent \ - && apt-get autoremove -y \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && (ln -s /opt/rstudio-pm/bin/rspm /usr/local/bin/rspm || echo "/usr/local/bin/rspm symlink already exists") - -# Set default R version symlink -RUN ln -s /opt/R/${R_VERSION} /opt/R/default - -# Add run script and set permissions -------------------------------------------# -COPY --chmod=0775 startup.sh /usr/local/bin/startup.sh -RUN mkdir -p /var/run/rstudio-pm \ - && chmod +x /usr/local/bin/startup.sh \ - && chown rstudio-pm:rstudio-pm /usr/local/bin/startup.sh \ - && chown -R rstudio-pm:rstudio-pm /var/run/rstudio-pm - -USER rstudio-pm -COPY rstudio-pm.gcfg /etc/rstudio-pm/rstudio-pm.gcfg - -# Set up licensing to work in userspace mode. This will not prevent activating a -# license as root, but it is required to activate one as the non-root user at -# runtime. It's possible for this to fail and the trail will be considered over, -# in which case we can ignore it anyway. -RUN license-manager initialize --userspace || true - -ENTRYPOINT ["tini", "--"] -CMD ["/usr/local/bin/startup.sh"] diff --git a/package-manager/Dockerfile.ubuntu2204 b/package-manager/Dockerfile.ubuntu2204 index a6fc4966c..216a4b326 100644 --- a/package-manager/Dockerfile.ubuntu2204 +++ b/package-manager/Dockerfile.ubuntu2204 @@ -1,9 +1,12 @@ ARG R_VERSION=4.2.3 -FROM rstudio/r-base:${R_VERSION}-jammy +ARG R_VERSION_ALT=4.1.3 +ARG PYTHON_VERSION=3.9.17 +ARG PYTHON_VERSION_ALT=3.8.17 +ARG SRC_IMAGE_NAME=product-base-pro +ARG REGISTRY=ghcr.io +FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:ubuntu2204-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT} LABEL maintainer="RStudio Docker " -ARG R_VERSION=4.2.3 - # Locale configuration --------------------------------------------------------# RUN localedef -i en_US -f UTF-8 en_US.UTF-8 ENV LANG en_US.UTF-8 @@ -25,6 +28,9 @@ RUN apt-get update --fix-missing \ gpg-agent \ && rm -rf /var/lib/apt/lists/* +# Required Python packages ----------------------------------------------------# +RUN pip3 install --no-cache-dir build virtualenv + # Runtime settings ------------------------------------------------------------# ADD https://cdn.rstudio.com/platform/tini/v${TINI_VERSION}/tini-amd64 /tini ADD https://cdn.rstudio.com/platform/tini/v${TINI_VERSION}/tini-amd64.asc /tini.asc