-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Update setup for local development for Deepnote engineers #40
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -1,32 +1,52 @@ | ||
| ARG FROM_PYTHON_TAG | ||
| # Dockerfile for local development with hot-reload support | ||
| # This container expects the toolkit source to be mounted at /toolkit | ||
| # and installs it in editable mode for live code changes | ||
| # | ||
| # Build with: | ||
| # docker build -t deepnote/jupyter-for-local:local -f dockerfiles/jupyter-for-local-hotreload/Dockerfile . | ||
|
|
||
| ARG FROM_PYTHON_TAG=3.12 | ||
| FROM deepnote/python:${FROM_PYTHON_TAG} | ||
|
|
||
| ARG FROM_PYTHON_TAG | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && \ | ||
| apt-get install -y openjdk-17-jdk && \ | ||
| apt-get install --no-install-recommends -y \ | ||
| rsync \ | ||
| git \ | ||
| # Required for pymssql | ||
| freetds-dev \ | ||
| # Required for database connectivity through ODBC | ||
| unixodbc-dev \ | ||
| # Required for secure connections (SSL/TLS) | ||
| libssl-dev && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN pip install poetry==2.2.0 | ||
| # Install Poetry and required plugins | ||
| RUN pip install --no-cache-dir poetry==2.2.0 && \ | ||
| poetry self add 'poetry-dynamic-versioning[plugin]>=1.0.0,<2.0.0' | ||
|
|
||
| WORKDIR /deepnote-toolkit | ||
| # Configure Poetry to create virtualenv outside the mounted source directory | ||
| RUN poetry config virtualenvs.path /opt/venvs | ||
|
|
||
| ENV POETRY_NO_INTERACTION=1 \ | ||
| POETRY_VIRTUALENVS_CREATE=1 \ | ||
| POETRY_VIRTUALENVS_IN_PROJECT=0 \ | ||
| POETRY_CACHE_DIR=/tmp/poetry_cache | ||
| # Create toolkit directory (will be mounted over, but needed for initial setup) | ||
| RUN mkdir -p /toolkit /opt/venvs | ||
|
Comment on lines
16
to
+37
Contributor
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. 🧹 Nitpick | 🔵 Trivial Consider consolidating RUN instructions to reduce layer count. The multiple RUN commands (lines 16, 30, 34, 37) can be consolidated into fewer layers. For example, combining apt-get install, Poetry installation, Poetry config, and directory creation into two or three RUN instructions would improve build efficiency and reduce image size. Consolidation example: -# Install system dependencies
-RUN apt-get update && \
+# Install system dependencies and Poetry
+RUN apt-get update && \
apt-get install --no-install-recommends -y \
rsync \
git \
- # Required for pymssql
freetds-dev \
- # Required for database connectivity through ODBC
unixodbc-dev \
- # Required for secure connections (SSL/TLS)
libssl-dev && \
apt-get clean && \
- rm -rf /var/lib/apt/lists/*
+ rm -rf /var/lib/apt/lists/* && \
+ pip install --no-cache-dir poetry==2.2.0 && \
+ poetry self add 'poetry-dynamic-versioning[plugin]>=1.0.0,<2.0.0' && \
+ poetry config virtualenvs.path /opt/venvs && \
+ mkdir -p /toolkit /opt/venvsThis reduces from 4+ RUN layers to 1, improving build time and image size.
🧰 Tools🪛 Hadolint (2.14.0)[warning] 16-16: Pin versions in apt get install. Instead of (DL3008) [info] 37-37: Multiple consecutive (DL3059) |
||
|
|
||
| COPY pyproject.toml poetry.lock poetry.toml ./ | ||
| WORKDIR /toolkit | ||
|
|
||
| RUN poetry install --no-interaction --no-ansi --with server --with dev | ||
| # Environment variables for development mode | ||
| ENV DEEPNOTE_RUNNING_IN_DEV_MODE=true \ | ||
| PYTHONDONTWRITEBYTECODE=1 \ | ||
| PYTHONUNBUFFERED=1 | ||
|
|
||
| ENV PYTHONPATH=/deepnote-toolkit:/deepnote-toolkit/installer:$PYTHONPATH \ | ||
| TOOLKIT_BUNDLE_PATH=/deepnote-toolkit \ | ||
| TOOLKIT_VERSION="local-build" \ | ||
| USERNAME=user \ | ||
| PASSWORD=password \ | ||
| DEEPNOTE_RUNNING_IN_DEV_MODE=true \ | ||
| DEEPNOTE_WEBAPP_URL="http://host.docker.internal:3002" | ||
| # Copy the entrypoint script | ||
| COPY dockerfiles/jupyter-for-local-hotreload/entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| COPY dockerfiles/jupyter-for-local-hotreload/run-installer.sh /usr/local/bin/run-installer.sh | ||
| EXPOSE 8888 | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/run-installer.sh"] | ||
| ENTRYPOINT ["/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Entrypoint script for local development container | ||
| # Installs toolkit in editable mode and starts servers via deepnote-toolkit CLI | ||
|
|
||
| echo "[local-toolkit] Starting local development environment..." | ||
|
|
||
| # Check if toolkit source is mounted | ||
| if [ ! -f "/toolkit/pyproject.toml" ]; then | ||
| echo "[local-toolkit] ERROR: Toolkit source not found at /toolkit" | ||
| echo "[local-toolkit] Make sure to mount the deepnote-toolkit directory to /toolkit" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd /toolkit | ||
|
|
||
| # Mark git directory as safe (needed for poetry-dynamic-versioning) | ||
| git config --global --add safe.directory /toolkit | ||
|
|
||
| # Install dependencies and toolkit in editable mode | ||
| echo "[local-toolkit] Installing toolkit in editable mode..." | ||
| poetry install --extras server --no-interaction | ||
|
|
||
| echo "[local-toolkit] Starting servers..." | ||
|
|
||
| # Start servers using the toolkit CLI (handles Jupyter, LSP, config, etc.) | ||
| exec poetry run deepnote-toolkit server "$@" |
This file was deleted.
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.
Add blank lines around code fences (MD031).
Lines 159–161 and 166–168 need blank lines before and after the fenced code blocks per markdown linting standards.
Apply this diff:
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
159-159: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
166-166: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🤖 Prompt for AI Agents