-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Provide new python base * Relocate changes for permissions issues * Test course image * Fix broken path * Testing for 573 * Update 573/python/Dockerfile Co-authored-by: Joel Ostblom <[email protected]> --------- Co-authored-by: Joel Ostblom <[email protected]>
- Loading branch information
1 parent
891b93d
commit 4ebd37b
Showing
10 changed files
with
223 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Publishes docker image, pinning actions to a commit SHA, | ||
# and updating most recently built image with the latest tag. | ||
# Can be triggered by either pushing a commit that changes the `Dockerfile`, | ||
# or manually dispatching the workflow. | ||
|
||
name: Publish Docker image (573 Python) | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '573/python/Dockerfile' | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ubcmds/573-python | ||
tags: | | ||
type=raw, value={{sha}},enable=${{github.ref_type != 'tag' }} | ||
type=raw, value=latest | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: ./573/python | ||
file: 573/python/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Publishes docker image, pinning actions to a commit SHA, | ||
# and updating most recently built image with the latest tag. | ||
# Can be triggered by either pushing a commit that changes the `Dockerfile`, | ||
# or manually dispatching the workflow. | ||
|
||
name: Publish Docker image (Testing Purposes) | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'base-python/course-example/Dockerfile' | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ubcmds/pl-testing | ||
tags: | | ||
type=raw, value=pythonRebuild | ||
type=raw, value=latest | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: ./base-python/course-example/ | ||
file: base-python/course-example/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
FROM jupyter/minimal-notebook:2023-10-20 | ||
|
||
ENV XDG_DATA_HOME=/tmp/local/share | ||
ENV XDG_CACHE_HOME=/tmp/cache | ||
ENV XDG_CONFIG_HOME=/tmp/config | ||
ENV JUPYTER_RUNTIME_DIR /tmp/runtime | ||
ENV JUPYTER_ALLOW_INSECURE_WRITES true | ||
ENV JUPYTER_CONFIG_DIR=/tmp/jupyter_config | ||
ENV NPM_CONFIG_CACHE=/tmp/npm | ||
ENV NO_UPDATE_NOTIFIER=true | ||
ENV IPYTHONDIR=/tmp/ipython | ||
ENV YARN_CACHE_FOLDER=/tmp/yarn_cache | ||
ENV PYTHONSTARTUP=/pythonstartup.py | ||
|
||
USER root | ||
# Install dependencies and various libraries | ||
RUN apt-get update && apt-get -y upgrade | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Suppress the opt-in dialog for announcements. | ||
# https://stackoverflow.com/questions/75511508/how-to-stop-this-message-would-you-like-to-receive-official-jupyter-news | ||
RUN jupyter labextension disable @jupyterlab/apputils-extension:announcements | ||
RUN mamba install --yes \ | ||
'altair-all==5.4.1' \ | ||
'vegafusion==1.6.9' \ | ||
'vega_datasets' \ | ||
'python>=3.11,<3.13' \ | ||
'pip' \ | ||
'ipykernel' \ | ||
'nb_conda_kernels' \ | ||
'otter-grader=6.*' \ | ||
'scipy' \ | ||
'matplotlib>=3.2.2' \ | ||
'scikit-learn' \ | ||
'requests>=2.24.0' \ | ||
'graphviz' \ | ||
'python-graphviz' \ | ||
'eli5' \ | ||
'shap' \ | ||
'jinja2' \ | ||
'lightgbm' \ | ||
'spacy' \ | ||
'xgboost' \ | ||
'catboost' \ | ||
'nltk' \ | ||
'imbalanced-learn' && \ | ||
mamba clean --all -f -y && \ | ||
fix-permissions "${CONDA_DIR}" && \ | ||
fix-permissions "/home/${NB_USER}" | ||
|
||
RUN python -m pip install mglearn spacymoji "altair_ally>=0.1.1" | ||
|
||
|
||
# This seems to be needed for Jupyterlab to get the anywidget extension installed | ||
# although the package is technically already installed as part of altair-all. | ||
# This package is needed to show altair charts offline, such as in CBTF. | ||
# Each notebook need to start with `alt.renderers.enable('jupyter', offline=True)` | ||
RUN python -m pip install anywidget | ||
RUN pip3 cache purge | ||
|
||
COPY jupyter_server_config.py /etc/jupyter/ | ||
#COPY plugin.jupyterlab-settings /etc/jupyter/ | ||
COPY ipython_config.py /etc/ipython/ | ||
|
||
RUN sed -i 's/"default": 120/"default": 1/' /opt/conda/share/jupyter/lab/schemas/@jupyterlab/docmanager-extension/plugin.json | ||
RUN sed -i 's/"default": 120/"default": 1/' /opt/conda/lib/python3.11/site-packages/jupyterlab/schemas/@jupyterlab/docmanager-extension/plugin.json | ||
|
||
|
||
EXPOSE 8080 | ||
|
||
USER jovyan | ||
COPY pythonstartup.py / | ||
CMD ["start.sh", "jupyter", "lab"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ipython_config.py | ||
c = get_config() | ||
c.Completer.use_jedi = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
|
||
c = get_config() # type: ignore # noqa F821 | ||
|
||
c.ServerApp.base_url = "/" | ||
if "WORKSPACE_BASE_URL" in os.environ: | ||
c.NotebookApp.base_url = os.environ["WORKSPACE_BASE_URL"] | ||
|
||
c.ServerApp.port = 8080 | ||
c.ServerApp.ip = "0.0.0.0" | ||
c.ServerApp.open_browser = False | ||
c.ServerApp.password = "" | ||
c.ServerApp.token = "" | ||
c.ServerApp.allow_origin = "*" | ||
|
||
# RTC appears to be broken in the current version of `jupyter-collaboration`: | ||
# https://github.com/jupyterlab/jupyter-collaboration/issues/162 | ||
# This opt-in will only be useful once the underlying issue is resolved. | ||
enable_rtc = bool(os.environ.get("ENABLE_REAL_TIME_COLLABORATION", False)) | ||
c.YDocExtension.disable_rtc = not enable_rtc | ||
|
||
# `LAUNCH_FILE_NAME` can be set to open a specific file when the workspace is opened. | ||
if "LAUNCH_FILE_NAME" in os.environ: | ||
# The "RTC" drive needs to be used if real-time collaboration is enabled. | ||
# This isn't documented, but is discussed in these issues: | ||
# https://github.com/jupyterlab/jupyter-collaboration/issues/202 | ||
# https://github.com/jupyterlab/jupyter-collaboration/issues/183 | ||
drive = "RTC:" if enable_rtc else "" | ||
c.LabApp.default_url= f"/lab/tree/{drive}{os.environ['LAUNCH_FILE_NAME']}" | ||
|
||
c.FileContentsManager.delete_to_trash = False | ||
c.FileCheckpoints.checkpoint_dir = "/tmp/ipynb_checkpoints" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import altair as alt | ||
alt.renderers.enable('jupyter', offline=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Use the base image provided by MDS | ||
FROM ubcmds/base-python:6acbbd2 | ||
|
||
# Define additional packages that are specific to this course | ||
ENV PYTHON_PACKAGES="scipy" | ||
|
||
# Install the pre-defined Python packages | ||
RUN pip install --no-cache-dir $PYTHON_PACKAGES | ||
|
||
EXPOSE 8080 | ||
# End course image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ipython_config.py | ||
c = get_config() | ||
c.Completer.use_jedi = False |
This file was deleted.
Oops, something went wrong.