-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add VS Code Dev Container Configuration #19597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kadykov
wants to merge
2
commits into
darktable-org:master
Choose a base branch
from
kadykov:devcontainer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+279
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,76 @@ | ||
| # Use Ubuntu 24.04 LTS as base image | ||
| FROM ubuntu:24.04 | ||
|
|
||
| # Avoid prompts from apt | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Set up locale | ||
| RUN apt-get update && apt-get install -y locales && \ | ||
| locale-gen en_US.UTF-8 && \ | ||
| update-locale LANG=en_US.UTF-8 | ||
|
|
||
| ENV LANG=en_US.UTF-8 | ||
| ENV LANGUAGE=en_US:en | ||
| ENV LC_ALL=en_US.UTF-8 | ||
|
|
||
| # Install build dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| # Build tools | ||
| build-essential \ | ||
| cmake \ | ||
| git \ | ||
| ninja-build \ | ||
| pkg-config \ | ||
| intltool \ | ||
| gettext \ | ||
| po4a \ | ||
| xsltproc \ | ||
| libxml2-utils \ | ||
| python3-jsonschema \ | ||
| # Required dependencies | ||
| libgtk-3-dev \ | ||
| libglib2.0-dev \ | ||
| libsqlite3-dev \ | ||
| libcurl4-openssl-dev \ | ||
| libpng-dev \ | ||
| libexiv2-dev \ | ||
| libpugixml-dev \ | ||
| liblensfun-dev \ | ||
| libjpeg-dev \ | ||
| libtiff-dev \ | ||
| liblcms2-dev \ | ||
| librsvg2-dev \ | ||
| libjson-glib-dev \ | ||
| # Optional dependencies for full functionality | ||
| libomp-dev \ | ||
| llvm-dev \ | ||
| ocl-icd-opencl-dev \ | ||
| liblua5.4-dev \ | ||
| libgphoto2-dev \ | ||
| libimath-dev \ | ||
| libavif-dev \ | ||
| libheif-dev \ | ||
| libjxl-dev \ | ||
| libwebp-dev \ | ||
| libcolord-dev \ | ||
| libportmidi-dev \ | ||
| libsdl2-dev \ | ||
| libcups2-dev \ | ||
| libopenexr-dev \ | ||
| libopenjp2-7-dev \ | ||
| libgraphicsmagick1-dev \ | ||
| # Additional tools | ||
| clang-format \ | ||
| vim \ | ||
| nano \ | ||
| wget \ | ||
| curl \ | ||
| sudo \ | ||
| # AppImage building tools | ||
| desktop-file-utils \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /workspace | ||
|
|
||
| CMD ["/bin/bash"] |
This file contains hidden or 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,169 @@ | ||
| # Darktable Development Container | ||
|
|
||
| A complete development environment for building and testing darktable with all dependencies pre-installed. | ||
|
|
||
| ## Purpose | ||
|
|
||
| This devcontainer provides: | ||
| - ✅ Build darktable from source | ||
| - ✅ Create AppImage for GUI testing on host | ||
| - ✅ Debug with GDB | ||
| - ❌ Does NOT run GUI inside container (use AppImage on host) | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - [Docker](https://www.docker.com/products/docker-desktop/) | ||
| - [Visual Studio Code](https://code.visualstudio.com/) with [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. Open this repository in VS Code | ||
| 2. Click "Reopen in Container" when prompted (or F1 → "Dev Containers: Reopen in Container") | ||
| 3. Wait for container build (~5-10 minutes first time) | ||
| 4. Git submodules are initialized automatically | ||
| 5. You're ready to build! | ||
|
|
||
| ## Building Darktable | ||
|
|
||
| ### Basic Build (for development) | ||
|
|
||
| ```bash | ||
| # Build darktable (binaries in ./build/bin/) | ||
| ./build.sh --prefix /tmp/dt --build-type RelWithDebInfo | ||
|
|
||
| # Run from build directory | ||
| ./build/bin/darktable --version | ||
| ``` | ||
|
|
||
| ### Build with Debug Symbols | ||
|
|
||
| ```bash | ||
| ./build.sh --prefix /tmp/dt --build-type Debug | ||
| ``` | ||
|
|
||
| ### Clean Build | ||
|
|
||
| ```bash | ||
| rm -rf build | ||
| ./build.sh --prefix /tmp/dt --build-type RelWithDebInfo | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ### GUI Testing with AppImage | ||
|
|
||
| GUI testing requires building an AppImage and running it on your host system: | ||
|
|
||
| ```bash | ||
| # 1. Create lensfun directory (avoids warnings) | ||
| sudo mkdir -p /var/lib/lensfun-updates | ||
|
|
||
| # 2. Build AppImage (takes ~10-15 minutes) | ||
| APPIMAGE_EXTRACT_AND_RUN=1 ./tools/appimage-build-script.sh | ||
|
|
||
| # 3. The AppImage is created in: build/Darktable-*.AppImage | ||
| ``` | ||
|
|
||
| **To run on your host:** | ||
|
|
||
| ```bash | ||
| # From host terminal (not in container) | ||
| # If workspace is mounted, the AppImage is accessible at: | ||
| cd <repo-path>/build | ||
|
|
||
| # Make executable and run | ||
| chmod +x Darktable-*.AppImage | ||
| ./Darktable-*.AppImage --configdir ~/.config/darktable-test | ||
| ``` | ||
|
|
||
| **Using `--configdir`** creates a separate configuration to avoid conflicts with your production darktable installation. | ||
|
|
||
| ## Development Tools Included | ||
|
|
||
| - **Compilers:** GCC 13, Clang | ||
| - **Build Systems:** CMake, Ninja, Make | ||
| - **Libraries:** GTK3, GLib, SQLite, libcurl, Exiv2, libavif, libheif, libjxl, WebP, and more | ||
| - **VS Code Extensions:** C/C++ tools, CMake Tools, clang-format | ||
| - **Editors:** vim, nano | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Build fails with missing dependencies | ||
|
|
||
| ```bash | ||
| # Rebuild the container | ||
| # F1 → "Dev Containers: Rebuild Container" | ||
| ``` | ||
|
|
||
| ### Git submodules not initialized | ||
|
|
||
| ```bash | ||
| git submodule init && git submodule update | ||
| ``` | ||
|
|
||
| ### AppImage build fails with FUSE error | ||
|
|
||
| Always use the environment variable: | ||
| ```bash | ||
| APPIMAGE_EXTRACT_AND_RUN=1 ./tools/appimage-build-script.sh | ||
| ``` | ||
|
|
||
| ### Need to install additional packages | ||
|
|
||
| ```bash | ||
| sudo apt-get update | ||
| sudo apt-get install <package-name> | ||
| ``` | ||
|
|
||
| ### Want to enable unit tests? | ||
|
|
||
| Tests are disabled by default and require additional dependencies. To enable: | ||
|
|
||
| ```bash | ||
| # Install test framework | ||
| sudo apt-get install -y libcmocka-dev | ||
|
|
||
| # Build with tests enabled | ||
| ./build.sh --prefix /tmp/dt --build-type RelWithDebInfo -- -DBUILD_TESTING=ON | ||
|
|
||
| # Run tests | ||
| cd build && ctest | ||
| ``` | ||
|
|
||
| ## File Structure | ||
|
|
||
| ``` | ||
| .devcontainer/ | ||
| ├── devcontainer.json # Container configuration | ||
| ├── Dockerfile # Environment setup with all build dependencies | ||
| └── README.md # This file | ||
| ``` | ||
|
|
||
| ## Build Options Reference | ||
|
|
||
| ```bash | ||
| # Build types | ||
| --build-type Release # Optimized, no debug info | ||
| --build-type Debug # Debug symbols, no optimization | ||
| --build-type RelWithDebInfo # Optimized + debug symbols (recommended) | ||
|
|
||
| # Parallel jobs | ||
| -j N # Use N parallel jobs (default: all CPUs) | ||
|
|
||
| # Installation | ||
| --prefix <path> # Set installation prefix (not required for development) | ||
| --install # Actually install files (not recommended in container) | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - Workspace folder mounted at `/workspaces/darktable` | ||
| - Build artifacts go to `build/` directory | ||
| - Container runs as user `vscode` (UID 1000) | ||
| - Git submodules initialized automatically on container creation | ||
|
|
||
| ## Resources | ||
|
|
||
| - [Darktable Build Instructions](https://github.com/darktable-org/darktable#building) | ||
| - [Developer's Guide](https://github.com/darktable-org/darktable/wiki/Developer's-guide) | ||
| - [User Manual](https://docs.darktable.org/) | ||
This file contains hidden or 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,33 @@ | ||
| { | ||
| "name": "Darktable Development", | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "context": ".." | ||
| }, | ||
| "runArgs": [ | ||
| "--cap-add=SYS_PTRACE", | ||
| "--security-opt=seccomp=unconfined" | ||
| ], | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/common-utils:2": { | ||
| "username": "vscode" | ||
| } | ||
| }, | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-vscode.cpptools", | ||
| "ms-vscode.cmake-tools", | ||
| "xaver.clang-format", | ||
| "ms-vscode.cpptools-extension-pack" | ||
| ], | ||
| "settings": { | ||
| "cmake.configureOnOpen": false, | ||
| "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" | ||
| } | ||
| } | ||
| }, | ||
| "forwardPorts": [], | ||
| "postCreateCommand": "git submodule init && git submodule update && echo 'Development environment ready! See .devcontainer/README.md for build instructions.'", | ||
| "remoteUser": "vscode" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -27,3 +27,4 @@ CMakeLists.txt.user | |
| workspace/ | ||
| cmake-build-debug/ | ||
| .idea/ | ||
| AppDir/ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.