Skip to content
Merged
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
99 changes: 9 additions & 90 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,94 +1,15 @@
FROM ubuntu:24.04

LABEL org.opencontainers.image.title="GoodMem Dev Environment" \
org.opencontainers.image.description="Minimal setup for developing with GoodMem APIs (Python + JS + .NET)" \
org.opencontainers.image.version="1.1.0"
org.opencontainers.image.description="Minimal setup for developing with GoodMem API through GoodMem CLI" \
org.opencontainers.image.version="1.2.0"

SHELL ["/bin/bash", "-c"]

# Base deps
# Base dependencies
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

# Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs

# .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.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 \
&& rm /tmp/go.tgz
ENV GOROOT=/usr/local/go
ENV GOPATH=/home/vscode/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
# quick sanity
RUN go version

# ---- Java (OpenJDK 21) ----
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
ENV PATH="$JAVA_HOME/bin:${PATH}"

# quick sanity
RUN java -version && javac -version

# ---- Gradle (official binary) ----
RUN curl -fsSL https://services.gradle.org/distributions/gradle-8.9-bin.zip -o /tmp/gradle.zip \
&& unzip -q /tmp/gradle.zip -d /opt \
&& ln -s /opt/gradle-8.9 /opt/gradle \
&& rm -f /tmp/gradle.zip
ENV PATH="/opt/gradle/bin:${PATH}"


# quick sanity
RUN gradle -v

# Python defaults
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
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 \
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/*
apt-transport-https sudo

# Dev user
# EDIT: DISABLED for now to avoid permission issues with mounted volumes
Expand All @@ -98,12 +19,10 @@ RUN rm -rf /var/lib/apt/lists/*
# mkdir -p /home/vscode/.goodmem/data/database && \
# chown -R vscode:vscode /home/vscode/.goodmem

# USER vscode
# APT clean up
RUN rm -rf /var/lib/apt/lists/*

# Use Codespaces default; the repo will be mounted at /workspaces/<repo>
WORKDIR /workspaces
# USER vscode

# Create Python virtual environment and activate it by default
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
# # Use Codespaces default; the repo will be mounted at /workspaces/<repo>
# WORKDIR /workspaces
26 changes: 26 additions & 0 deletions .devcontainer/configure-goodmem.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Install GoodMem and initialize (create root user and generate API key while saving it to config.toml)
echo "Installing GoodMem..."
curl -s "https://get.goodmem.ai" | bash -s -- --handsfree --db-password "my-secure-password"

# Extract API key and add to ~/.bashrc
echo "Configuring GoodMem API key..."
if [ -f ~/.goodmem/config.toml ]; then
API_KEY=$(grep "^api_key" ~/.goodmem/config.toml | cut -d"'" -f2)
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
echo "***REMEMBER GOODMEM_API_KEY=\"$API_KEY\"***"
else
echo "Warning: Could not extract api_key from config.toml"
fi
else
echo "Warning: ~/.goodmem/config.toml not found"
fi

echo "GoodMem installation and configuration complete!"
13 changes: 6 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{
"name": "GoodMem Dev Container",
// "build": { "dockerfile": "Dockerfile" },
"image": "ghcr.io/pair-systems-inc/devcontainer-codespace:latest",
// build docker image from local Dockerfile
"build": { "dockerfile": "Dockerfile" },

// "postCreateCommand": "bash .devcontainer/setup.sh", # Skip example code setup
"postCreateCommand": "bash .devcontainer/post-setup.sh",
// build docker image from latest build on github container registry
// "image": "ghcr.io/pair-systems-inc/devcontainer-codespace:latest",

"postCreateCommand": "bash .devcontainer/configure-goodmem.sh",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-vscode.vscode-docker",
"ms-toolsai.jupyter"
"ms-vscode.vscode-docker"
]
}
}
Expand Down
Loading
Loading