diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..7e6813c --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,35 @@ +# Development Container for SQLite Query Analyzer + +This directory contains configuration for a development container that provides a consistent environment for building and testing the SQLite Query Analyzer. + +## Features + +- Full C++ development environment with GCC/Clang +- Qt 6.9.0 for GUI development +- PowerShell for cross-platform scripting +- SSH server for remote development +- Docker-in-Docker for building Snap packages + +## Building Snap Packages + +The development container is configured with Docker-in-Docker support for building Snap packages. You can use the `snap-build` command to build Snap packages from within the container: + +```bash +# Navigate to your project directory +cd /workspaces/sqlitequery + +# Build snap package +snap-build +``` + +The `snap-build` command is a wrapper around the Snapcraft Docker container that ensures: + +1. Snap packages can be built within the development container +2. No need to install snapd or snapcraft directly in the container +3. Consistent build environment across all development machines + +## Additional Notes + +- The build command mounts your current directory into the Snapcraft container +- You can pass additional arguments to snapcraft by adding them to the `snap-build` command +- If you need to customize the snap building process further, you can modify the `.devcontainer/snap-build.sh` script \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bb73158..e30d767 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,10 +3,11 @@ "image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04", // Base image "features": { "ghcr.io/devcontainers/features/powershell:1": {}, - "ghcr.io/devcontainers/features/sshd:1.0.10": {} + "ghcr.io/devcontainers/features/sshd:1.0.10": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, "forwardPorts": [22], - "postCreateCommand": "sudo apt-get update && sudo apt-get install -y python3 python3-pip && sudo apt install -y libglx-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig1 libdbus-1-dev && pip install aqtinstall --break-system-packages && aqt install-qt linux desktop 6.9.0", + "postCreateCommand": "sudo apt-get update && sudo apt-get install -y python3 python3-pip && sudo apt install -y libglx-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig1 libdbus-1-dev && pip install aqtinstall --break-system-packages && aqt install-qt linux desktop 6.9.0 && sudo cp /workspaces/sqlitequery/.devcontainer/snap-build.sh /usr/local/bin/snap-build && sudo chmod +x /usr/local/bin/snap-build", "remoteUser": "vscode", "remoteEnv": { "QT_DIR": "/workspaces/sqlitequery/6.9.0/gcc_64", diff --git a/.devcontainer/snap-build.sh b/.devcontainer/snap-build.sh new file mode 100755 index 0000000..8910425 --- /dev/null +++ b/.devcontainer/snap-build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# This script provides an easy way to build snap packages in the development container + +# Check if we're in the right directory +if [ ! -f "snapcraft.yaml" ] && [ ! -f "snap/snapcraft.yaml" ]; then + echo "Error: No snapcraft.yaml found in current directory or snap/ subdirectory" + echo "Please run this script from the project root directory" + exit 1 +fi + +echo "Building snap package using snapcraft Docker container..." +docker pull snapcore/snapcraft:stable +docker run --rm -v "$(pwd)":/build -w /build snapcore/snapcraft:stable snapcraft "$@" + +echo "Snap package build complete!" \ No newline at end of file