-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add Workbench for Google Cloud Workstations image #564
Changes from all commits
abc7317
6e24894
644ba11
a4ee3cb
615fc8a
a4a1050
d18d1f4
59c5311
c1c0c9b
1e37205
3f3aae5
ab7fc30
ddddc93
aae928e
6eebba8
92c8ae6
3044a2a
5255855
6603b4c
9284a6c
688a26c
384f8a7
c2fdab0
8dd907a
beda951
b6b5f41
a9e4c67
0bd44ff
415f76d
ad6bec7
9139881
b39e39d
76f2157
c352f56
0ece256
2216c8e
56636e0
c6826c8
2b143d9
feacba9
5892faa
9684acf
de07b3c
946a3f4
24ec2e4
ece18d2
fc0695c
f23851a
02919f1
04a16fc
6602fbe
1326aa5
94f0252
4226145
6838023
36b1de8
20c8857
8b623d3
8dfcf64
ff7e23b
9c35403
2fac16a
09ae19a
55579d9
505336a
1a7b2f3
c9469d0
1fcaf39
4a99504
07821a2
978a8c1
d707e49
2248836
d8642b7
1582be1
824245a
ef74e28
94d0571
88525c1
7d1b98d
0400594
29939e5
0f124be
2602e5c
0351692
e1c1679
42069d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
RSW_VERSION=2023.03.2+454.pro2 | ||
RSW_TAG_VERSION=2023.03.2-454.pro2 | ||
RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/bionic/amd64 | ||
RSW_NAME=rstudio-workbench | ||
PYTHON_VERSION=3.10.12 | ||
PYTHON_VERSION_ALT=3.9.17 | ||
PYTHON_VERSION_JUPYTER=3.10.12 | ||
R_VERSION=4.2.3 | ||
R_VERSION_ALT=4.1.3 | ||
DRIVERS_VERSION=2023.05.0 | ||
QUARTO_VERSION=1.3.340 | ||
IMAGE_REGISTRY_NAME=us-central1-docker.pkg.dev/posit-images/cloud-workstations/workbench |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
conf/launcher.pem | ||
conf/launcher.pub |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
FROM us-central1-docker.pkg.dev/cloud-workstations-images/predefined/base:public-image-current | ||
|
||
### ARG declarations ### | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG R_VERSION=4.2.3 | ||
ARG R_VERSION_ALT=4.1.3 | ||
ARG PYTHON_VERSION=3.10.12 | ||
ARG PYTHON_VERSION_ALT=3.9.17 | ||
ARG PYTHON_VERSION_JUPYTER=3.10.12 | ||
ARG QUARTO_VERSION=1.3.340 | ||
ARG DRIVERS_VERSION=2023.05.0 | ||
ARG RSW_VERSION=2023.03.2+454.pro2 | ||
ARG RSW_NAME=rstudio-workbench | ||
ARG RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/bionic/amd64 | ||
|
||
ENV RSW_LICENSE "" | ||
ENV RSW_LICENSE_SERVER "" | ||
ENV RSW_TESTUSER user | ||
ENV RSW_TESTUSER_PASSWD rstudio | ||
ENV RSW_TESTUSER_UID 10000 | ||
ENV RSW_LAUNCHER true | ||
ENV RSW_LAUNCHER_TIMEOUT 10 | ||
ENV DIAGNOSTIC_DIR /var/log/rstudio | ||
ENV DIAGNOSTIC_ENABLE false | ||
ENV DIAGNOSTIC_ONLY false | ||
ENV LICENSE_MANAGER_PATH /opt/rstudio-license | ||
ENV WORKBENCH_JUPYTER_PATH=/usr/local/bin/jupyter | ||
|
||
### Copy package lists and install scripts ### | ||
COPY deps/* / | ||
|
||
### Update/upgrade system packages ### | ||
RUN apt-get update --fix-missing \ | ||
&& apt-get upgrade -yq \ | ||
&& xargs -a /apt_packages.txt apt-get install -yq --no-install-recommends \ | ||
&& rm /apt_packages.txt \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
### Install R versions ### | ||
RUN curl -O https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it might be nicer to write a proper bash file here, and then use a loop for these duplicated lines. I'm ambivalent. It would be extra work. It would make the Dockerfile easier to read and update. It might make it easier to run/debug scripts outside of docker builds. Up to you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Mike. I think this could be useful, and I agree with your later comment about making this a follow-up issue so this can be addressed across multiple images. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
&& curl -O https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION_ALT}_1_amd64.deb \ | ||
&& apt-get update \ | ||
ianpittwood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
&& apt-get install -yq --no-install-recommends ./r-${R_VERSION}_1_amd64.deb \ | ||
&& apt-get install -yq --no-install-recommends ./r-${R_VERSION_ALT}_1_amd64.deb \ | ||
&& rm -f ./r-${R_VERSION}_1_amd64.deb \ | ||
&& rm -f ./r-${R_VERSION_ALT}_1_amd64.deb \ | ||
&& ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R \ | ||
&& ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
### Install Python versions ### | ||
RUN curl -O https://cdn.rstudio.com/python/ubuntu-2004/pkgs/python-${PYTHON_VERSION}_1_amd64.deb \ | ||
&& curl -O https://cdn.rstudio.com/python/ubuntu-2004/pkgs/python-${PYTHON_VERSION_ALT}_1_amd64.deb \ | ||
&& apt-get update \ | ||
ianpittwood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
&& apt-get install -yq --no-install-recommends ./python-${PYTHON_VERSION}_1_amd64.deb \ | ||
&& apt-get install -yq --no-install-recommends ./python-${PYTHON_VERSION_ALT}_1_amd64.deb \ | ||
&& rm -rf python-${PYTHON_VERSION}_1_amd64.deb \ | ||
&& rm -rf python-${PYTHON_VERSION_ALT}_1_amd64.deb \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install 'virtualenv<20' \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install --upgrade setuptools \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install --upgrade pip \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip cache purge \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install 'virtualenv<20' \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install --upgrade setuptools \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install --upgrade pip \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip cache purge \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
### Install basic data science packages for Python and R ### | ||
RUN /opt/python/${PYTHON_VERSION}/bin/python3 -m pip install -r /py_packages.txt \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip cache purge \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip install -r /py_packages.txt \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip cache purge \ | ||
&& ./install_r_packages.sh \ | ||
&& rm install_r_packages.sh py_packages.txt r_packages.txt | ||
|
||
### 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 | ||
|
||
### Install Quarto ### | ||
RUN curl -o quarto-linux-amd64.deb -L https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb \ | ||
&& apt-get update \ | ||
&& apt-get install -yq ./quarto-linux-amd64.deb \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rm quarto-linux-amd64.deb | ||
|
||
### Install Pro Drivers ### | ||
RUN apt-get update \ | ||
&& apt-get install -yq --no-install-recommends unixodbc unixodbc-dev \ | ||
&& curl -O https://cdn.rstudio.com/drivers/7C152C12/installer/rstudio-drivers_${DRIVERS_VERSION}_amd64.deb \ | ||
&& apt-get update \ | ||
&& apt-get install -yq --no-install-recommends ./rstudio-drivers_${DRIVERS_VERSION}_amd64.deb \ | ||
&& rm -f ./rstudio-drivers_${DRIVERS_VERSION}_amd64.deb \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& cp /opt/rstudio-drivers/odbcinst.ini.sample /etc/odbcinst.ini \ | ||
&& /opt/R/${R_VERSION}/bin/R -e 'install.packages("odbc", repos="https://packagemanager.rstudio.com/cran/__linux__/focal/latest")' | ||
|
||
### Install Workbench ### | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN curl -o rstudio-workbench.deb "${RSW_DOWNLOAD_URL}/${RSW_NAME}-${RSW_VERSION//+/-}-amd64.deb" \ | ||
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 3F32EE77E331692F \ | ||
&& dpkg-sig --verify ./rstudio-workbench.deb \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends ./rstudio-workbench.deb \ | ||
&& rm ./rstudio-workbench.deb \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rm -rf /var/lib/rstudio-server/r-versions | ||
|
||
### Install GCW License Manager ### | ||
# TODO(ianpittwood): Replace monitor download with $RSW_VERSION after upgrading to 2023.06.0 | ||
RUN mkdir -p /opt/rstudio-license/ \ | ||
&& mkdir -p /var/lib/rstudio-workbench \ | ||
&& curl -sL "https://s3.amazonaws.com/rstudio-ide-build/monitor/focal/rsp-monitor-workbench-gcpw-amd64-2023.06.0-419.pro1.tar.gz" | \ | ||
tar xzvf - --strip 2 -C /opt/rstudio-license/ \ | ||
&& chmod 0755 /opt/rstudio-license/license-manager \ | ||
&& mv /opt/rstudio-license/license-manager /opt/rstudio-license/license-manager-orig \ | ||
&& rm -f /usr/lib/rstudio-server/bin/license-manager | ||
|
||
### Install Jupyter and extensions ### | ||
RUN /opt/python/"${PYTHON_VERSION_JUPYTER}"/bin/python -m venv /opt/python/jupyter \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A lot of this stuff has me feeling like we should have centralized scripts for this stuff. We must be duplicating a ton of this stuff between this and the other workstations image. I don't think it's important to consolidate it all here in this PR, but perhaps it is worth filing a tech debt ticket for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
&& /opt/python/jupyter/bin/pip install \ | ||
jupyter \ | ||
jupyterlab \ | ||
rsconnect_jupyter \ | ||
rsconnect_python \ | ||
rsp_jupyter \ | ||
workbench_jupyterlab \ | ||
&& ln -s /opt/python/jupyter/bin/jupyter /usr/local/bin/jupyter \ | ||
&& /opt/python/jupyter/bin/jupyter-nbextension install --sys-prefix --py rsp_jupyter \ | ||
&& /opt/python/jupyter/bin/jupyter-nbextension enable --sys-prefix --py rsp_jupyter \ | ||
&& /opt/python/jupyter/bin/jupyter-nbextension install --sys-prefix --py rsconnect_jupyter \ | ||
&& /opt/python/jupyter/bin/jupyter-nbextension enable --sys-prefix --py rsconnect_jupyter \ | ||
&& /opt/python/jupyter/bin/jupyter-serverextension enable --sys-prefix --py rsconnect_jupyter \ | ||
&& /opt/python/jupyter/bin/python -m ipykernel install --name py${PYTHON_VERSION} --display-name "Python ${PYTHON_VERSION}" \ | ||
&& /opt/python/jupyter/bin/python -m ipykernel install --name py${PYTHON_VERSION_ALT} --display-name "Python ${PYTHON_VERSION_ALT}" \ | ||
&& /opt/python/${PYTHON_VERSION}/bin/python3 -m pip cache purge \ | ||
&& /opt/python/${PYTHON_VERSION_ALT}/bin/python3 -m pip cache purge | ||
|
||
RUN curl -L -o /usr/local/bin/wait-for-it.sh https://raw.githubusercontent.com/rstudio/wait-for-it/master/wait-for-it.sh \ | ||
&& chmod +x /usr/local/bin/wait-for-it.sh | ||
|
||
RUN mkdir -p /var/lib/rstudio-server/monitor/log \ | ||
&& chown -R rstudio-server:rstudio-server /var/lib/rstudio-server/monitor \ | ||
&& mkdir -p /startup/custom/ \ | ||
&& printf '\n# allow home directory creation\nsession required pam_mkhomedir.so skel=/etc/skel umask=0022' >> /etc/pam.d/common-session | ||
|
||
COPY --chmod=755 TurboActivate.dat /opt/rstudio-license/license-manager.conf | ||
COPY --chmod=755 license-manager-shim /opt/rstudio-license/license-manager | ||
COPY --chmod=0775 startup.sh /usr/local/bin/startup.sh | ||
COPY startup-launcher/* /startup/launcher/ | ||
COPY startup-user-provisioning/* /startup/user-provisioning/ | ||
COPY startup/* /startup/base/ | ||
COPY supervisord.conf /etc/supervisor/supervisord.conf | ||
COPY --chmod=600 sssd.conf /etc/sssd/sssd.conf | ||
COPY conf/* /etc/rstudio/ | ||
COPY --chmod=600 conf/launcher.p* /etc/rstudio | ||
|
||
# GCW specific | ||
COPY --chmod=755 workstation-startup/* /etc/workstation-startup.d/ | ||
COPY --chmod=644 jupyter/jupyter_notebook_config.json /opt/python/jupyter/etc/jupyter/jupyter_notebook_config.json | ||
|
||
### Clean up ### | ||
RUN apt-get remove -yq dpkg-sig \ | ||
&& apt-get install -yqf --no-install-recommends \ | ||
&& apt-get autoremove -yq \ | ||
&& apt-get clean -yq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 80/tcp | ||
EXPOSE 5559/tcp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This confused me, as I thought that it was a third installation of python. Why are we explicitly setting this? Why isn't it just always presumed to be installed at PYTHON_VERSION?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the pattern of the other Workbench products. I personally have no problem defaulting to one version or the other, but we should probably make it a global change for the repo. It would make more sense to default the Jupyter install to the primary or alt version. I feel like this only causes problems for users, though I doubt many people will build directly from this project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#614