Skip to content
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

Merged
merged 87 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
abc7317
Fork the Workbench image for Google Cloud Workstations
ianpittwood Feb 21, 2023
6e24894
Add changes pulled from Cole's alpha image
ianpittwood Mar 8, 2023
644ba11
Changes necessary for working image
ianpittwood Mar 14, 2023
a4ee3cb
Add VS Code "cloudcode" plugin
ianpittwood Mar 29, 2023
615fc8a
Upgrade to Workbench 2023.03.0
ianpittwood Apr 7, 2023
a4a1050
Build workflow and Jupyter improvements
ianpittwood Apr 10, 2023
d18d1f4
Pipeline syntax fix
ianpittwood Apr 10, 2023
59c5311
Fix build-args syntax
ianpittwood Apr 10, 2023
c1c0c9b
One-line tags
ianpittwood Apr 10, 2023
1e37205
Use dumb docker list format
ianpittwood Apr 10, 2023
3f3aae5
Add just setup
ianpittwood Apr 10, 2023
ab7fc30
Trim double quotes
ianpittwood Apr 10, 2023
ddddc93
Fix + in tag version
ianpittwood Apr 10, 2023
aae928e
Adapt Dockerfile to Ubuntu 20.04 base
ianpittwood Apr 10, 2023
6eebba8
Fix env var references
ianpittwood Apr 10, 2023
92c8ae6
Fix odbc install OS
ianpittwood Apr 10, 2023
3044a2a
Fix download URL
ianpittwood Apr 10, 2023
5255855
Disable build tests for now until I get Goss working again
ianpittwood Apr 11, 2023
6603b4c
Quiet flag on gcloud auth
ianpittwood Apr 11, 2023
9284a6c
Merge push action into build step
ianpittwood Apr 11, 2023
688a26c
Add configure script step for jupyter notebook
ianpittwood Apr 12, 2023
384f8a7
Add jupyter notebook config to fix jupyter terminal bug
ianpittwood Apr 12, 2023
c2fdab0
Add a variety of basic data science packages into the image
ianpittwood Apr 12, 2023
8dd907a
Add lab-args
ianpittwood Apr 13, 2023
beda951
Fix allow_origin arg
ianpittwood Apr 13, 2023
b6b5f41
Revert jupyter.conf changes
ianpittwood Apr 13, 2023
a9e4c67
Add Quarto and temporarily add args to Jupyter Lab for debugging
ianpittwood Apr 14, 2023
0bd44ff
Fix goss tests
ianpittwood Apr 20, 2023
415f76d
Add PYTHON_VERSION_JUPYTER in workflow
ianpittwood Apr 20, 2023
ad6bec7
Fixes to build from daily with JupyterLab fix
ianpittwood Apr 20, 2023
9139881
Replace tagged version variable
ianpittwood Apr 20, 2023
b39e39d
Update r_packages.txt with R Package Dependencies list
ianpittwood Apr 20, 2023
76f2157
Update test and push blocks in workflow
ianpittwood Apr 21, 2023
c352f56
Fix test path
ianpittwood Apr 21, 2023
0ece256
Specify tag for test
ianpittwood Apr 21, 2023
2216c8e
Use just for build pipeline
ianpittwood Apr 21, 2023
56636e0
Add tags to build step
ianpittwood Apr 21, 2023
c6826c8
Quote tags
ianpittwood Apr 21, 2023
2b143d9
Last fix for pushing tags
ianpittwood Apr 21, 2023
feacba9
Use just command for pushing
ianpittwood Apr 21, 2023
5892faa
Fixes after push failure
ianpittwood Apr 24, 2023
9684acf
Implement cache inflation bug workaround
ianpittwood Apr 24, 2023
de07b3c
Push all tags
ianpittwood Apr 24, 2023
946a3f4
Run docker image ls to see why images aren't found
ianpittwood Apr 24, 2023
24ec2e4
Package and dependency updates
ianpittwood Apr 24, 2023
ece18d2
Just retag the image and forget about this problem for now
ianpittwood Apr 25, 2023
fc0695c
Update registry name to release registry
ianpittwood Apr 25, 2023
f23851a
Temporarily continue on error for tests
ianpittwood Apr 26, 2023
02919f1
Improve Goss tests based on #490
ianpittwood May 2, 2023
04a16fc
Update VSCode Extensions
ianpittwood May 3, 2023
6602fbe
Disable pipeline caching
ianpittwood May 8, 2023
1326aa5
Disable pipeline caching
ianpittwood May 16, 2023
94f0252
Update RSW_VERSION var
ianpittwood May 16, 2023
4226145
Update launcher-env PATH
ianpittwood May 16, 2023
6838023
Upgrade R and Python versions
ianpittwood May 19, 2023
36b1de8
License manager implementation for WGCW
ianpittwood Jun 6, 2023
20c8857
Update env var
ianpittwood Jun 8, 2023
8b623d3
Comment out exec logging
ianpittwood Jun 8, 2023
8dfcf64
Maximize build space for GCW GHA
ianpittwood Jun 22, 2023
ff7e23b
Change buildx caching to a mounted directory with actual space
ianpittwood Jun 22, 2023
9c35403
Dynamically set buildx caching path from var
ianpittwood Jun 22, 2023
2fac16a
Upgrade Workbench for GCW
ianpittwood Jun 22, 2023
09ae19a
Use build-push-action in GHA
ianpittwood Jun 22, 2023
55579d9
Remove maximize build space, may not be necessary
ianpittwood Jun 22, 2023
505336a
Rollback python version upgrade, not yet released
ianpittwood Jun 23, 2023
1a7b2f3
Fix missed version
ianpittwood Jun 23, 2023
c9469d0
Upgrade Workbench to 2023.06.0 and tick donwload url to focal
ianpittwood Jun 23, 2023
1fcaf39
Explicitly define download url in build workflow
ianpittwood Jun 23, 2023
4a99504
Upgrade workflow to 2023.06.0
ianpittwood Jun 23, 2023
07821a2
Increase timeout for R lib goss tests
ianpittwood Jun 23, 2023
978a8c1
Remove "load" from push action
ianpittwood Jun 23, 2023
d707e49
Rollback to 2023.03.2
ianpittwood Jun 28, 2023
2248836
Remove unnecessary launcher keys
ianpittwood Jun 29, 2023
d8642b7
Update workbench-for-google-cloud-workstations/Justfile
ianpittwood Jun 29, 2023
1582be1
Use .env file for Justfile and GHA workflow
ianpittwood Jul 6, 2023
824245a
Fix test step in workflow
ianpittwood Jul 6, 2023
ef74e28
Revise README.md from original copy to GCW specific copy
ianpittwood Jul 6, 2023
94d0571
Clean up caching
ianpittwood Jul 6, 2023
88525c1
Remove `-x` flag from `just run` target
ianpittwood Jul 6, 2023
7d1b98d
Update versions for bug fixes
ianpittwood Jul 27, 2023
0400594
Rebase and merge WGCW workflow into release workflow
ianpittwood Aug 8, 2023
29939e5
Fix missing shell
ianpittwood Aug 8, 2023
0f124be
Merge branch 'dev' into gcw-workbench
ianpittwood Aug 8, 2023
2602e5c
Fix bash logic
ianpittwood Aug 8, 2023
0351692
Do not trace licensing in startup.sh
ianpittwood Aug 9, 2023
e1c1679
Update patch in launcher-env
ianpittwood Aug 9, 2023
42069d7
Move apt package list to deps/apt_packages.txt
ianpittwood Aug 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/build-test-scan-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
description: Username for authentication with DockerHub
required: true
type: string
gcp-json:
description: JSON for authenticating Google Cloud Platform
default: ""
type: string

runs:
using: "composite"
Expand All @@ -71,6 +75,19 @@ runs:
username: ${{ inputs.dockerhub-username }}
password: ${{ inputs.dockerhub-token }}

- name: Authenticate to Google Cloud
continue-on-error: true
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ inputs.gcp-json }}'

- name: Authenticate GCAR
shell: bash
run: |
if [ ! -z "${{ inputs.gcp-json }}" ]; then
gcloud auth configure-docker -q us-central1-docker.pkg.dev
fi

- name: Build
id: image-build
uses: docker/build-push-action@v4
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,86 @@ jobs:
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

# End retry logic

build-workbench-for-google-cloud-workstations:
needs: [ build-base, build-base-pro ]
runs-on: ubuntu-latest
name: build-workbench-for-google-cloud-workstations

concurrency:
group: build-products-${{ matrix.config.product }}-${{ matrix.config.os }}-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Set up Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get Version
id: get-version
run: |
VERSION=$(just workbench-for-google-cloud-workstations/get-version)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Get build args
id: get-build-args
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
BUILD_ARGS=$(just workbench-for-google-cloud-workstations/get-build-args)
echo "BUILD_ARGS<<$EOF" >> $GITHUB_OUTPUT
echo "$BUILD_ARGS" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT

- name: Get tags
id: get-tags
run: |
IMAGE_TAGS=$(just workbench-for-google-cloud-workstations/get-build-tags)
echo "IMAGE_TAGS=$IMAGE_TAGS" >> $GITHUB_OUTPUT

- name: Build/Test/Scan/Push base pro image
id: build1
uses: ./.github/actions/build-test-scan-push
continue-on-error: true
with:
context: ./workbench-for-google-cloud-workstations
os: ubuntu2004
product: workbench-for-google-cloud-workstations
image-tags: ${{ steps.get-tags.outputs.IMAGE_TAGS }}
build-args: ${{ steps.get-build-args.outputs.BUILD_ARGS }}
push-image: ${{ github.ref == 'refs/heads/main' }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
snyk-org-id: ${{ secrets.SNYK_ORG_ID }}
ghcr-token: ${{ secrets.BUILD_PAT }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
gcp-json: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'

# Begin retry logic

- name: Wait 60s on failure before retrying
if: steps.build1.outcome == 'failure'
run: sleep 60

- name: Retry - Build/Test/Scan/Push base pro image
id: build2
if: steps.build1.outcome == 'failure'
uses: ./.github/actions/build-test-scan-push
with:
context: ./workbench-for-google-cloud-workstations
os: ubuntu2004
product: workbench-for-google-cloud-workstations
image-tags: ${{ steps.get-tags.outputs.IMAGE_TAGS }}
build-args: ${{ steps.get-build-args.outputs.BUILD_ARGS }}
push-image: ${{ github.ref == 'refs/heads/main' }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
snyk-org-id: ${{ secrets.SNYK_ORG_ID }}
ghcr-token: ${{ secrets.BUILD_PAT }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
gcp-json: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'

# End retry logic
12 changes: 12 additions & 0 deletions workbench-for-google-cloud-workstations/.env
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
Copy link
Contributor

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?

Copy link
Collaborator Author

@ianpittwood ianpittwood Aug 9, 2023

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
2 changes: 2 additions & 0 deletions workbench-for-google-cloud-workstations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
conf/launcher.pem
conf/launcher.pub
175 changes: 175 additions & 0 deletions workbench-for-google-cloud-workstations/Dockerfile.ubuntu2004
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 \
Copy link
Contributor

Choose a reason for hiding this comment

The 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!

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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 \
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Loading