generated from sfeir-open-source/sfeir-school-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add
devcontainer
support to ease the setup of the dev workst…
…ation with `python`, `ollama`, etc When opening the project in `VSCode` or `IntellJ`, provided user has Docker installed and the **[DevContainer(https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)]** This will automatically: - Install Python 3 - Create the Venv `.source.venv` and print instructions to activate it - (VSCodde) Automatically setup the Python Interpreter from the venv - (VSCode) Install the `Jupyter` extension and enabled `Python` support - Download and Start `Ollama Server` - Pull some LLMs (`llama2` by defaut)
- Loading branch information
Showing
4 changed files
with
105 additions
and
1 deletion.
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,55 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node | ||
{ | ||
"name": "SFEIR School LangChain", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye", | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"installZsh": true, | ||
"installOhMyZsh": true, | ||
"installOhMyZshConfig": true, | ||
"upgradePackages": true, | ||
"username": "automatic", | ||
"userUid": "automatic", | ||
"userGid": "automatic" | ||
}, | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"installTools": true, | ||
"installJupyterlab": true, | ||
"version": "3.12" | ||
} | ||
}, | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "./.devcontainer/postCreateCommand.sh", | ||
|
||
// Use 'postCreateCommand' to run commands after the container is started. | ||
"postStartCommand": "./.devcontainer/postStartCommand.sh", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"mhutchie.git-graph", | ||
"anweber.reveal-button", | ||
"ms-python.python", | ||
"ms-python.debugpy", | ||
"ms-toolsai.jupyter" | ||
], | ||
"settings":{ | ||
"python.pythonPath": "./.school.venv/bin/python", | ||
"debug.javascript.autoAttachFilter": "onlyWithFlag" | ||
} | ||
} | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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,26 @@ | ||
#!/bin/sh | ||
|
||
# Installing Node Modules | ||
#npm ci | ||
|
||
# Installing Ollama | ||
|
||
echo "⬇️ Downloading and Installing Ollama Server..." | ||
curl https://ollama.ai/install.sh | sh | ||
|
||
# Create the virtual environment (if missing) | ||
if [ ! -f .school.venv/bin/activate ]; then | ||
echo "➕ Creating the virtual environment (.school.venv)..." | ||
virtualenv .school.venv | ||
fi | ||
|
||
echo "✅ Setup done" | ||
|
||
# Activate the virtual environment for this terminal session | ||
echo "" | ||
echo "Please don't forget to run the following command in your terminal..." | ||
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️" | ||
echo "source .school.venv/bin/activate" | ||
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️" | ||
echo "...(to activate the virtual env) before installing Python dependencies!" | ||
echo "" |
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,22 @@ | ||
#!/bin/sh | ||
|
||
# Starting Ollama Server | ||
echo "🏃🏿♂️ Starting Ollama Server..." | ||
ollama serve & | ||
|
||
echo "⬇️ Pulling LLMs..." | ||
ollama pull llama2 | ||
#ollama pull mistral | ||
#ollama pull codellama | ||
|
||
echo "✅ Local LLMs Setup done!" | ||
|
||
|
||
# Activate the virtual environment for this terminal session | ||
echo "" | ||
echo "Please don't forget to run the following command in your terminal..." | ||
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️" | ||
echo "source .school.venv/bin/activate" | ||
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️" | ||
echo "...(to activate the virtual env) before installing Python dependencies!" | ||
echo "" |
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 |
---|---|---|
|
@@ -69,4 +69,5 @@ typings/ | |
#Dev | ||
docs/test.html | ||
|
||
.venv* | ||
.venv* | ||
.school.venv |