diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a2802a0..65c642e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -11,22 +11,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl wget git unzip gnupg ca-certificates software-properties-common \ build-essential apt-transport-https sudo \ python3 python3-venv python3-pip python3-dev \ - libffi-dev libssl-dev libpq-dev cargo \ - && rm -rf /var/lib/apt/lists/* + libffi-dev libssl-dev libpq-dev cargo # Node.js 20 RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ - apt-get install -y nodejs && \ - rm -rf /var/lib/apt/lists/* + apt-get install -y nodejs -# .NET SDK 8.0 (update to 9.0 if desired by changing the package name) -RUN wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ - dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb && \ - apt-get update && apt-get install -y dotnet-sdk-8.0 && \ - rm -rf /var/lib/apt/lists/* +# .NET SDK 9.0 +RUN add-apt-repository ppa:dotnet/backports && \ + apt-get update && \ + apt-get install -y dotnet-sdk-9.0 #Go -ARG GO_VERSION=1.22.5 +ARG GO_VERSION=1.24.6 RUN curl -fsSL https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz -o /tmp/go.tgz \ && rm -rf /usr/local/go \ && tar -C /usr/local -xzf /tmp/go.tgz \ @@ -37,10 +34,8 @@ ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH # quick sanity RUN go version -#Java - # ---- Java (OpenJDK 21) ---- -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get install -y --no-install-recommends \ openjdk-21-jdk \ && rm -rf /var/lib/apt/lists/* ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 @@ -66,16 +61,44 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 # Global Python deps RUN pip install --no-cache-dir --break-system-packages \ - goodmem_client openai requests python-dotenv + goodmem_client openai requests python-dotenv \ + jupyter lab + +# Dotnet Interactive (for Jupyter) +RUN dotnet tool install --global Microsoft.dotnet-interactive +ENV PATH="/root/.dotnet/tools:${PATH}" +RUN dotnet interactive jupyter install + +# IJavascript (Node.js kernel for Jupyter) +RUN npm config set prefix $HOME +RUN npm install -g ijavascript +ENV PATH="/root/bin:${PATH}" +RUN ijsinstall + +# JJava (Java kernel for Jupyter) +RUN curl -fsSL https://github.com/dflib/jjava/releases/download/1.0-a5/jjava-1.0-a5-kernelspec.zip -o /tmp/jjava.zip && \ + unzip -q /tmp/jjava.zip -d /tmp/jjava-1.0-a5-kernelspec && \ + cd /tmp && \ + jupyter kernelspec install jjava-1.0-a5-kernelspec --user --name=java + +# GONB (Go kernel for Jupyter) +RUN go install github.com/janpfeifer/gonb@latest && \ + go install golang.org/x/tools/cmd/goimports@latest && \ + go install golang.org/x/tools/gopls@latest +RUN gonb --install + +# APT clean up +RUN rm -rf /var/lib/apt/lists/* # Dev user -RUN useradd -m -s /bin/bash vscode && \ - echo "vscode ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vscode-nopasswd && \ - chmod 0440 /etc/sudoers.d/vscode-nopasswd && \ - mkdir -p /home/vscode/.goodmem/data/database && \ - chown -R vscode:vscode /home/vscode/.goodmem - -USER vscode +# EDIT: DISABLED for now to avoid permission issues with mounted volumes +# RUN useradd -m -s /bin/bash vscode && \ +# echo "vscode ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vscode-nopasswd && \ +# chmod 0440 /etc/sudoers.d/vscode-nopasswd && \ +# mkdir -p /home/vscode/.goodmem/data/database && \ +# chown -R vscode:vscode /home/vscode/.goodmem + +# USER vscode # Use Codespaces default; the repo will be mounted at /workspaces/ WORKDIR /workspaces diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0e84012..be6f10e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,8 +2,7 @@ "name": "GoodMem Dev Container", "build": { "dockerfile": "Dockerfile" }, - "postCreateCommand": "bash .devcontainer/setup.sh", - "postAttachCommand": "curl -s https://get.goodmem.ai | bash -s -- --prod-install --no-openai-embedder-registration", + "postCreateCommand": "bash .devcontainer/setup.sh && bash .devcontainer/post-setup.sh", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} diff --git a/.devcontainer/post-setup.sh b/.devcontainer/post-setup.sh new file mode 100755 index 0000000..ba8959a --- /dev/null +++ b/.devcontainer/post-setup.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +echo "=== Post-setup script started ===" + +# 1. Install GoodMem +echo "Installing GoodMem..." +curl -s https://get.goodmem.ai | bash -s -- --prod-install --no-openai-embedder-registration + +# 2. Extract API key and add to ~/.bashrc +echo "Configuring GoodMem API key..." +if [ -f ~/.goodmem/config.json ]; then + API_KEY=$(grep -o '"api_key"[[:space:]]*:[[:space:]]*"[^"]*"' ~/.goodmem/config.json | cut -d'"' -f4) + if [ -n "$API_KEY" ]; then + if ! grep -q "GOODMEM_API_KEY" ~/.bashrc; then + echo "export GOODMEM_API_KEY=\"$API_KEY\"" >> ~/.bashrc + echo "Added GOODMEM_API_KEY to ~/.bashrc" + else + echo "GOODMEM_API_KEY already exists in ~/.bashrc" + fi + else + echo "Warning: Could not extract api_key from config.json" + fi +else + echo "Warning: ~/.goodmem/config.json not found" +fi + +# 3. Clone the GoodMem repository +echo "Cloning GoodMem repository..." +GOODMEM_REPO_DIR="$HOME/goodmem" +if [ ! -d "$GOODMEM_REPO_DIR" ]; then + git clone https://github.com/PAIR-Systems-Inc/goodmem.git "$GOODMEM_REPO_DIR" + echo "GoodMem repository cloned to $GOODMEM_REPO_DIR" +else + echo "GoodMem repository already exists at $GOODMEM_REPO_DIR" +fi + +echo "=== Post-setup script completed ==="