Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .devcontainer/cache/before-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# This file establishes a basline for the repository before any steps in the "prepare.sh"
# are run. Its just a find command that filters out a few things we don't need to watch.

set -e
SOURCE_FOLDER="${1:-"."}"
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"

cd "${SOURCE_FOLDER}"
echo "[$(date)] Generating ""before"" manifest..."
mkdir -p "${CACHE_FOLDER}"
find -L . -not -path "*/.git/*" -and -not -path "${CACHE_FOLDER}/*.manifest" -type f > "${CACHE_FOLDER}/before.manifest"
echo "[$(date)] Done!"

28 changes: 28 additions & 0 deletions .devcontainer/cache/build-cache-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# This file simply wraps the docker build command to build an image that includes
# a cache.tar file with the result of "prepare.sh" inside of it. See cache.Dockerfile
# for the steps that are actually taken to do this.

set -e

SCRIPT_PATH="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
CONTAINER_IMAGE_REPOSITORY="$1"
BRANCH="${2:-"main"}"

if [ "${CONTAINER_IMAGE_REPOSITORY}" = "" ]; then
echo "Container repository not specified!"
exit 1
fi

TAG="branch-${BRANCH//\//-}"
echo "[$(date)] ${BRANCH} => ${TAG}"
cd "${SCRIPT_PATH}/../.."

echo "[$(date)] Starting image build and push..."
export DOCKER_BUILDKIT=1
docker buildx create --use --name vscode-dev-containers
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx build --push --platform linux/amd64,linux/arm64 -t ${CONTAINER_IMAGE_REPOSITORY}:"${TAG}" -f "${SCRIPT_PATH}/cache.Dockerfile" .

echo "[$(date)] Done!"
23 changes: 23 additions & 0 deletions .devcontainer/cache/cache-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# This file is used to archive off a copy of any differences in the source tree into another location
# in the image. Once the codespace / container is up, this will be restored into its proper location.

set -e

SOURCE_FOLDER="${1:-"."}"
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"

if [ ! -d "${CACHE_FOLDER}" ]; then
echo "No cache folder found. Be sure to run before-cache.sh to set one up."
exit 1
fi

echo "[$(date)] Starting cache operation..."
cd "${SOURCE_FOLDER}"
echo "[$(date)] Determining diffs..."
find -L . -not -path "*/.git/*" -and -not -path "${CACHE_FOLDER}/*.manifest" -type f > "${CACHE_FOLDER}/after.manifest"
grep -Fxvf "${CACHE_FOLDER}/before.manifest" "${CACHE_FOLDER}/after.manifest" > "${CACHE_FOLDER}/cache.manifest"
echo "[$(date)] Archiving diffs..."
tar -cf "${CACHE_FOLDER}/cache.tar" --totals --files-from "${CACHE_FOLDER}/cache.manifest"
echo "[$(date)] Done! $(du -h "${CACHE_FOLDER}/cache.tar")"
24 changes: 24 additions & 0 deletions .devcontainer/cache/cache.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This dockerfile is used to build up from a base image to create an image a cache.tar file containing the results of running "prepare.sh".
# Other image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile

# This first stage generates cache.tar
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as cache
ARG USERNAME=node
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
RUN mkdir -p ${CACHE_FOLDER} && chown ${USERNAME} ${CACHE_FOLDER} /repo-source-tmp \
&& su ${USERNAME} -c "\
cd /repo-source-tmp \
&& .devcontainer/cache/before-cache.sh . ${CACHE_FOLDER} \
&& .devcontainer/prepare.sh . ${CACHE_FOLDER} \
&& .devcontainer/cache/cache-diff.sh . ${CACHE_FOLDER}"

# This second stage starts fresh and just copies in cache.tar from the previous stage. The related
# devcontainer.json file is then setup to have postCreateCommand fire restore-diff.sh to expand it.
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as dev-container
ARG USERNAME=node
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
RUN mkdir -p "${CACHE_FOLDER}" \
&& chown "${USERNAME}:${USERNAME}" "${CACHE_FOLDER}" \
&& su ${USERNAME} -c "git config --global codespaces-theme.hide-status 1"
COPY --from=cache ${CACHE_FOLDER}/cache.tar ${CACHE_FOLDER}/
29 changes: 29 additions & 0 deletions .devcontainer/cache/restore-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# This file expands the cache.tar file in the image that contains the results of "prepare.sh"
# on top of the source tree. It runs as a postCreateCommand which runs after the container/codespace
# is already up where you would typically run a command like "yarn install".

set -e
SOURCE_FOLDER="$(cd "${1:-"."}" && pwd)"
CACHE_FOLDER="${2:-"$HOME/.devcontainer-cache"}"

if [ ! -d "${CACHE_FOLDER}" ]; then
echo "No cache folder found."
exit 0
fi

echo "[$(date)] Expanding $(du -h "${CACHE_FOLDER}/cache.tar") file to ${SOURCE_FOLDER}..."
cd "${SOURCE_FOLDER}"
# Ensure user/group is correct if the UID/GID was changed for some reason
echo "+1000 +$(id -u)" > "${CACHE_FOLDER}/cache-owner-map"
echo "+1000 +$(id -g)" > "${CACHE_FOLDER}/cache-group-map"
# Untar to workspace folder, preserving permissions and order, but mapping GID/UID if required
tar --owner-map="${CACHE_FOLDER}/cache-owner-map" --group-map="${CACHE_FOLDER}/cache-group-map" -xpsf "${CACHE_FOLDER}/cache.tar"
rm -rf "${CACHE_FOLDER}"
echo "[$(date)] Done!"

# Change ownership of chrome-sandbox
sudo chown root .build/electron/chrome-sandbox
sudo chmod 4755 .build/electron/chrome-sandbox

40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Code - OSS",

// Image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
"image": "mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:branch-main",
"overrideCommand": false,
"runArgs": [ "--init", "--security-opt", "seccomp=unconfined", "--shm-size=1g"],

"settings": {
"resmon.show.battery": false,
"resmon.show.cpufreq": false
},

// noVNC, VNC
"forwardPorts": [6080, 5901],
"portsAttributes": {
"6080": {
"label": "VNC web client (noVNC)",
"onAutoForward": "silent"
},
"5901": {
"label": "VNC TCP port",
"onAutoForward": "silent"
}
},

"extensions": [
"dbaeumer.vscode-eslint",
"mutantdino.resourcemonitor"
],

// Optionally loads a cached yarn install for the repo
"postCreateCommand": ".devcontainer/cache/restore-diff.sh",

"remoteUser": "node",

"hostRequirements": {
"memory": "8gb"
}
}
9 changes: 9 additions & 0 deletions .devcontainer/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

# This file contains the steps that should be run when building a "cache" image with contents that should be
# layered directly **on top of the source tree** once a dev container is created. This avoids having to run long
# running commands like "yarn install" from the ground up. Developers (and should) still run these commands
# after the actual dev container is created, but only differences will be processed.

yarn install
yarn electron
2 changes: 1 addition & 1 deletion .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ RUN sudo apt-get update \
g++ gcc make python2.7 pkg-config libx11-dev libxkbfile-dev libsecret-1-dev python-is-python3 rsync \
&& sudo rm -rf /var/lib/apt/lists/*

RUN bash -c 'VERSION="16.9.1" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'
RUN bash -c 'VERSION="16.17.0" && source $HOME/.nvm/nvm.sh && nvm install $VERSION && nvm use $VERSION && nvm alias default $VERSION'

RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix
5 changes: 4 additions & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ github:
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
addBadge: false
# add a label once the prebuild is ready to pull requests (defaults to false)
addLabel: false
addLabel: false
vscode:
extensions:
- mutantdino.resourcemonitor
19 changes: 0 additions & 19 deletions 1.sh

This file was deleted.

21 changes: 0 additions & 21 deletions extensions/jupyter-web/LICENSE

This file was deleted.

24 changes: 0 additions & 24 deletions extensions/jupyter-web/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions extensions/jupyter-web/extension.webpack.config.js

This file was deleted.

Binary file removed extensions/jupyter-web/images/jupyter.png
Binary file not shown.
Binary file removed extensions/jupyter-web/images/sample.PNG
Binary file not shown.
12 changes: 0 additions & 12 deletions extensions/jupyter-web/jsconfig.json

This file was deleted.

41 changes: 0 additions & 41 deletions extensions/jupyter-web/language-configuration.json

This file was deleted.

Loading