Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Devcontainer to speed up linux development of screenpipe (#1577)

Divanshu Grover75f56b5b032f
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 000000000..70764387a
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,67 @@
+# Use the specified base image
+FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
+
+# Switch to the vscode user
+USER vscode
+
+# Install Rust
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+
+# Update package lists and install dependencies
+RUN sudo apt-get update && sudo apt-get install -y \
+ g++ \
+ ffmpeg \
+ tesseract-ocr \
+ cmake \
+ libavformat-dev \
+ libavfilter-dev \
+ libavdevice-dev \
+ libssl-dev \
+ libtesseract-dev \
+ libxdo-dev \
+ libsdl2-dev \
+ libclang-dev \
+ libxtst-dev \
+ libx11-dev \
+ libxext-dev \
+ libxrandr-dev \
+ libxinerama-dev \
+ libxcursor-dev \
+ libxi-dev \
+ libgl1-mesa-dev \
+ libasound2-dev \
+ libpulse-dev \
+ curl \
+ pkg-config \
+ libsqlite3-dev \
+ sqlite3 \
+ libbz2-dev \
+ zlib1g-dev \
+ libonig-dev \
+ libayatana-appindicator3-dev \
+ libsamplerate-dev \
+ libwebrtc-audio-processing-dev \
+ libgtk-3-dev \
+ libwebkit2gtk-4.1-dev \
+ librsvg2-dev \
+ patchelf \
+ xvfb \
+ x11-utils \
+ x11-xserver-utils \
+ x11-apps \
+ xdotool \
+ openbox \
+ xterm \
+ fonts-liberation \
+ imagemagick \
+ fonts-dejavu \
+ alsa-utils \
+ pulseaudio \
+ pulseaudio-utils \
+ && sudo apt-get clean \
+ && sudo rm -rf /var/lib/apt/lists/*
+
+# Install Bun
+RUN curl -fsSL https://bun.sh/install | bash
+
+EXPOSE 3000 3030
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 000000000..d76ae1d34
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,29 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
+{
+ "name": "Screenpipe",
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+ "build": {
+ "dockerfile": "Dockerfile"
+ },
+ // Features to add to the dev container. More info: https://containers.dev/features.
+ // "features": {
+ // "ghcr.io/devcontainers/features/desktop-lite:1": {
+ // "password": "noPassword"
+ // }
+ // },
+
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ "forwardPorts": [3000, 3030],
+
+ // Use 'postCreateCommand' to run commands after the container is created.
+ "postCreateCommand": "bash /workspaces/screenpipe/.devcontainer/scripts/postCreateCommand.sh",
+
+ "onCreateCommand": "sudo cp .devcontainer/scripts/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
+
+ // Configure tool-specific properties.
+ // "customizations": {},
+
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+ // "remoteUser": "root"
+}
\ No newline at end of file
diff --git a/.devcontainer/scripts/linux_integration.sh b/.devcontainer/scripts/linux_integration.sh
new file mode 100755
index 000000000..df61d1fd6
--- /dev/null
+++ b/.devcontainer/scripts/linux_integration.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+log() {
+ echo -e "\e[1;34m[INFO]\e[0m $1"
+}
+export XDG_SESSION_TYPE="x11"
+export WAYLAND_DISPLAY=""
+
+# Change directory to Screenpipe folder
+cd /workspaces/screenpipe/
+
+log "Installing dependencies"
+.github/scripts/install_dependencies.sh
+
+log "Verifying Tesseract installation"
+.github/scripts/verify_tesseract.sh
+
+log "Building CLI"
+cargo build --release
+
+log "Setting up virtual display with window manager"
+.github/scripts/setup_display.sh
+
+log "Setting up audio"
+.github/scripts/setup_audio.sh
+
+log "Running Screenpipe"
+.github/scripts/run_screenpipe.sh
+
+log "Testing OCR"
+.github/scripts/test_ocr.sh
+
+log "Testing Audio Capture"
+.github/scripts/test_audio_capture.sh
+
+log "Stopping Screenpipe"
+.github/scripts/stop_screenpipe.sh
+
+log "Checking for crashes and expected behavior"
+.github/scripts/check_logs.sh
+
+log "Checking final storage usage"
+du -ha ~/.screenpipe/data
diff --git a/.devcontainer/scripts/postCreateCommand.sh b/.devcontainer/scripts/postCreateCommand.sh
new file mode 100755
index 000000000..282901f54
--- /dev/null
+++ b/.devcontainer/scripts/postCreateCommand.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Define the alias
+ALIAS_CMD="alias test-linux=\"/workspaces/screenpipe/.devcontainer/scripts/linux_integration.sh\""
+
+# Add alias to .bashrc if it exists
+grep -qxF "$ALIAS_CMD" ~/.bashrc || echo "$ALIAS_CMD" >> ~/.bashrc
+
+# Add alias to .zshrc if it exists
+grep -qxF "$ALIAS_CMD" ~/.zshrc || echo "$ALIAS_CMD" >> ~/.zshrc
diff --git a/.devcontainer/scripts/welcome-message.txt b/.devcontainer/scripts/welcome-message.txt
new file mode 100644
index 000000000..37d01c12a
--- /dev/null
+++ b/.devcontainer/scripts/welcome-message.txt
@@ -0,0 +1,8 @@
+πŸ‘‹ Welcome to Screenpipe!
+
+πŸ› οΈ Your environment is fully setup with all the required dependencies.
+
+πŸ“ We have set up an alias 'test-linux' for 'linux_integration.sh' in your shell configurations.
+
+πŸ’» You can run 'test-linux' in the terminal to check if the Linux build of the app is working.
+
diff --git a/.github/scripts/install_dependencies.sh b/.github/scripts/install_dependencies.sh
index 87c6443a8..95ff7ef18 100755
--- a/.github/scripts/install_dependencies.sh
+++ b/.github/scripts/install_dependencies.sh
@@ -1,3 +1,3 @@
#!/bin/bash
sudo apt-get update
-sudo apt-get install -y xvfb ffmpeg libasound2-dev libgtk-3-dev libavformat-dev libavfilter-dev libavdevice-dev x11-utils x11-apps xdotool sqlitebrowser openbox xterm fonts-liberation tesseract-ocr libtesseract-dev imagemagick fonts-dejavu alsa-utils pulseaudio pulseaudio-utils libxdo-dev
+sudo apt-get install -y xvfb x11-xserver-utils ffmpeg libasound2-dev libgtk-3-dev libavformat-dev libavfilter-dev libavdevice-dev x11-utils x11-apps xdotool sqlite3 openbox xterm fonts-liberation tesseract-ocr libtesseract-dev imagemagick fonts-dejavu alsa-utils pulseaudio pulseaudio-utils libxdo-dev