Skip to content

Commit 3ffeb04

Browse files
Adds tests to notebooks (substratusai#25)
Adds tests to the quickstart and dataset loader. Takes forever (~an hour) but ensures our docs work end to end.
1 parent 5242c6f commit 3ffeb04

23 files changed

+1620
-86
lines changed

.devcontainer/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
# [Option] Install zsh
4+
ARG INSTALL_ZSH="true"
5+
# [Option] Upgrade OS packages to their latest versions
6+
ARG UPGRADE_PACKAGES="false"
7+
# [Option] Enable non-root Docker access in container
8+
ARG ENABLE_NONROOT_DOCKER="true"
9+
# [Option] Use the OSS Moby CLI instead of the licensed Docker CLI
10+
ARG USE_MOBY="true"
11+
# [Option] Select CLI version
12+
ARG CLI_VERSION="latest"
13+
14+
# Enable new "BUILDKIT" mode for Docker CLI
15+
ENV DOCKER_BUILDKIT=1
16+
17+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your
18+
# own dependencies. A user of "automatic" attempts to reuse an user ID if one already exists.
19+
ARG USERNAME=automatic
20+
ARG USER_UID=1000
21+
ARG USER_GID=$USER_UID
22+
COPY library-scripts/*.sh /tmp/library-scripts/
23+
RUN apt-get update \
24+
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
25+
# Use Docker script from script library to set things up
26+
&& /bin/bash /tmp/library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" "${USE_MOBY}" "${CLI_VERSION}" \
27+
# Clean up
28+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
29+
30+
# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
31+
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
32+
# The script will also execute CMD if you need to alter startup behaviors.
33+
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
34+
35+
RUN apt-get update -y && \
36+
apt-get install -y --no-install-recommends \
37+
apt-transport-https \
38+
ca-certificates \
39+
gnupg \
40+
curl && \
41+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
42+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
43+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && \
44+
apt-get update -y && \
45+
apt-get install -y --no-install-recommends \
46+
google-cloud-cli \
47+
google-cloud-cli-gke-gcloud-auth-plugin \
48+
kubectl \
49+
python3 \
50+
python3-pip \
51+
gcc \
52+
python3-dev \
53+
nodejs
54+
55+
CMD [ "sleep", "infinity" ]

.devcontainer/devcontainer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// NOTE: this didn't work (docker from docker was fussy) but I think the dockerfile is worth keeping
2+
// to inform our dependencies during a CI run
3+
{
4+
"name": "Docker from Docker",
5+
"dockerFile": "Dockerfile",
6+
"runArgs": ["--init"],
7+
"mounts": [
8+
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind",
9+
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.gcp,target=/home/vscode/.gcp,type=bind,consistency=cached",
10+
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.kube,target=/home/vscode/.kube,type=bind,consistency=cached"
11+
],
12+
"overrideCommand": false,
13+
14+
// Use this environment variable if you need to bind mount your local source code into a new container.
15+
"remoteEnv": {
16+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
17+
},
18+
19+
// Configure tool-specific properties.
20+
"customizations": {
21+
// Configure properties specific to VS Code.
22+
"vscode": {
23+
// Add the IDs of extensions you want installed when the container is created.
24+
"extensions": [
25+
"ms-azuretools.vscode-docker",
26+
"ms-toolsai.jupyter",
27+
"pomdtr.excalidraw-editor",
28+
"visualstudioexptteam.vscodeintellicode",
29+
"ms-vsliveshare.vsliveshare",
30+
"davidanson.vscode-markdownlint",
31+
"esbenp.prettier-vscode",
32+
"ms-python.vscode-pylance",
33+
"ms-python.python",
34+
"stkb.rewrap",
35+
"vscodevim.vim",
36+
"ms-vscode.makefile-tools"
37+
]
38+
},
39+
// TODO(bjb): this doesnt work
40+
"postCreateCommand": "pip3 install -r requirements.txt && python3 -m ipykernel install --user"
41+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
42+
// "forwardPorts": [],
43+
44+
// Use 'postCreateCommand' to run commands after the container is created.
45+
46+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
47+
// "remoteUser": "vscode"
48+
}
49+
}

0 commit comments

Comments
 (0)