{"id":15136974,"url":"https://github.com/abeimler/simple-cppbuilder","last_synced_at":"2025-07-20T17:04:40.659Z","repository":{"id":46886209,"uuid":"382840351","full_name":"abeimler/simple-cppbuilder","owner":"abeimler","description":"Simple C++ Docker-Images with gcc/clang, cmake and dependency manager (conan and/or vcpkg).","archived":false,"fork":false,"pushed_at":"2023-01-14T05:59:31.000Z","size":363,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T05:44:45.646Z","etag":null,"topics":["builder","cmake","conan","cpp","docker","docker-container","docker-image","linux","vcpkg"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abeimler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-04T11:58:22.000Z","updated_at":"2025-03-04T12:50:49.000Z","dependencies_parsed_at":"2023-02-09T19:00:45.856Z","dependency_job_id":null,"html_url":"https://github.com/abeimler/simple-cppbuilder","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/abeimler/simple-cppbuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeimler%2Fsimple-cppbuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeimler%2Fsimple-cppbuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeimler%2Fsimple-cppbuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeimler%2Fsimple-cppbuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abeimler","download_url":"https://codeload.github.com/abeimler/simple-cppbuilder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeimler%2Fsimple-cppbuilder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266161906,"owners_count":23885928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builder","cmake","conan","cpp","docker","docker-container","docker-image","linux","vcpkg"],"created_at":"2024-09-26T06:42:25.328Z","updated_at":"2025-07-20T17:04:40.634Z","avatar_url":"https://github.com/abeimler.png","language":"Shell","readme":"# Simple C++ Docker Builder\n\n\u003ca href=\"https://hub.docker.com/r/abeimler/simple-cppbuilder\"\u003e![logo](https://raw.githubusercontent.com/abeimler/simple-cppbuilder/main/img/logo.png)\u003c/a\u003e  \n![ci](https://github.com/abeimler/simple-cppbuilder/actions/workflows/ci.yml/badge.svg)\n![license](https://img.shields.io/github/license/abeimler/simple-cppbuilder) ![stars](https://img.shields.io/docker/stars/abeimler/simple-cppbuilder)\n![docker-image-size](https://img.shields.io/docker/image-size/abeimler/simple-cppbuilder) \n![automated](https://img.shields.io/docker/automated/abeimler/simple-cppbuilder) ![pulls](https://img.shields.io/docker/pulls/abeimler/simple-cppbuilder) \n\n\nSimple C++ Builder with compilers, buildtools and dependency manager.\n\n## Features\n\n- Pre-installed Compilers and Tools\n- Ready to use ~~build scripts ([docker-build.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-build.sh) and [docker-test.sh](https://github.com/abeimler/simple-cppbuilder/blob/main/scripts/docker-test.sh))~~ [Taskfiles](https://github.com/abeimler/simple-cppbuilder/blob/main/taskfiles/TaskfileDefault.yml)\n\n## What's included\n\nBased on [archlinux:base-devel](https://hub.docker.com/_/archlinux) with [yay](https://github.com/Jguer/yay).\n\n- **Compilers:** [clang](https://llvm.org/), [gcc](https://gcc.gnu.org/) or cross-compiler\n- **Buildtools:** [cmake](https://cmake.org/), make and ninja\n- **Dependency Manager:** [conan](https://conan.io/) and/or [vcpkg](https://vcpkg.io/en/index.html)\n- **More Tools:** python, pip, ccache, cppcheck, doxygen and more\n\n## How to use this image\n\nYou can find a full C++ project example [here](https://github.com/abeimler/simple-cppbuilder/tree/main/examples/example).\n\n### Add Docker into your C++ Project\n\n1. Create a `Dockerfile` in your C++ project\n\n```Dockerfile\n## build stage\nFROM abeimler/simple-cppbuilder as build\nCOPY . .\nCMD [\"task\", \"-t\", \"/home/taskfiles/Taskfile.yml\", \"build\"]\n\n## test stage\nFROM build as test\nCMD [\"task\", \"-t\", \"/home/taskfiles/Taskfile.yml\", \"test\"]\n```\n\n2. Build and run the Docker image:\n\n```bash\n$ docker build -t my-cpp-project .\n$ docker run -it --rm --name my-app my-cpp-project\n```\n\n### Run a single file\n\n```bash\n$ docker run -it --rm --name my-cpp-project -v \"$PWD\":/home/project -w /home/project abeimler/simple-cppbuilder ./docker-build.sh\n```\n\n## Image Variants\n\n### `:base`\n\nBase image with gcc, buildtools and [conan](https://conan.io/) (dependency manager) installed.\n\n### `:\u003cversion\u003e`, `:latest`\n\nDefault image with gcc, buildtools, [conan](https://conan.io/) installed and [vcpkg](https://vcpkg.io/) bootstrapped.\n\n### Compilers\n\n#### `:clang`\n\nDefault image with clang compiler.\n\n#### `:gcc10`, `:gcc9` (outdated)\n\nDefault image with gcc compiler.\n\n### Libraries\n\n#### `:libcpp`\n\nDefault image with clang and [libc++](https://libcxx.llvm.org/) installed.\n\n#### `:boost`\n\nDefault image with [boost](https://www.boost.org/) installed.\n\n#### `:abseil-cpp`\n\nDefault image with [abseil](https://abseil.io/) installed.\n\n#### `:opengl-libs`\n\nDefault image with some OpenGL dependencies: `mesa glu glfw-x11 libx11 libxrender libxext libxcursor libxrandr libxinerama xorg-server-devel`.\n\n\n### Misc\n\n#### `:ci`, `:ci-x64-mingw-w64`\n\nAlternative Ubuntu-based image with basic compilers and tools.  \n_Nice base image for CI/CD._\n\n#### `:ci-setup-cpp`\n\nAlternative Ubuntu-based image with basic compilers and tools.  \n_Uses [setup-cpp](https://github.com/aminya/setup-cpp)._\n\n\n### Cross-Compiler (experimental)\n\n_Not fully tested_\n\n#### `:x64-mingw-w64`, `:x86-mingw-w64`\n\nDefault image with mingw-w64-cross-compiler: [mingw-w64-gcc](https://archlinux.org/packages/community/x86_64/mingw-w64-gcc/) and toolchain.\n\n#### `:x64-mingw-w64-mxe`, `x86-mingw-w64-mxe`, `:x64-mingw-w64-mxe-static`, `:x86-mingw-w64-mxe-static` (older compiler)\n\nDefault image with [mxe](https://mxe.cc/) and toolchain.\n\n#### `:emscripten`\n\nDefault image with [emscripten](https://emscripten.org/).\n\n#### `:rpi4`, `:rpi3`,  `:rpi2`, `:rpi1`\n\nDefault image with arm-cross-compiler: ([crosstool-ng](https://crosstool-ng.github.io/)) for RaspberryPi, raspberrypi-tools and toolchain.\n\n#### `:arm-android`, `:arm64-android`, `:x86-android`, `:x64-android`\n\nDefault image with [android-ndk](https://aur.archlinux.org/packages/android-ndk/) and toolchain.\n\n## More Examples\n\n### Dockerfile with system dependencies\n\n```Dockerfile\nFROM abeimler/simple-cppbuilder as base\n\nRUN pacman-db-upgrade \u0026\u0026 pacman -S --noconfirm  \\\n    qt5-base qt5-base-util \n\n# build stage\nFROM base as build\nCOPY . .\nCMD [\"task\", \"-t\", \"/home/taskfiles/Taskfile.yml\", \"build\"]\n```\n\n### Dockerfile using AUR\n\n```Dockerfile\nFROM abeimler/simple-cppbuilder as base\n\n# install android-sdk and android-ndk\nRUN runuser -l yay -c \\\n    \"yay -Syu --noconfirm \u0026\u0026 yay -S --noconfirm \\\n      android-sdk android-ndk\"\n\n# build stage\nFROM base as build\nCOPY . .\nCMD [\"./my-android-build.sh\"]\n```\n\n### Using docker-compose for build\n\n```yml\nversion: '3.4'\n\nservices:\n  # gcc Release with Ninja\n  gcc-release-build:\n    build:\n      context: .\n      dockerfile: Dockerfile\n      target: build\n    environment:\n      CC: gcc\n      CXX: g++\n      TARGET: all\n      BUILD_TYPE: Release\n      CMAKE_GENERATOR: Ninja\n```\n\n```bash\n$ docker-compose up --build\n```\n\n### Using docker-compose for testing\n\n```yml\nversion: '3.4'\n\nservices:\n  # gcc Debug with Ninja\n  gcc-debug-test:\n    build:\n      context: .\n      dockerfile: Dockerfile\n      target: test\n    environment:\n      TARGET: all\n      BUILD_TYPE: Debug\n      CMAKE_GENERATOR: Ninja\n```\n\n```bash\n$ docker-compose up --build\n```\n\n### ~~Use your custom build script~~ Better use a [Taskfile](https://taskfile.dev/usage/)\n\n#### ~~`my-build.sh`~~\n\n#### `Taskfile.yml`\n\n```yml\n---\nversion: \"3\"\n\nvars:\n  PROJECT_DIR: '{{.PROJECT_DIR | default \".\"}}'\n  TARGET: '{{.TARGET | default \"all\"}}'\n  CMAKE_GENERATOR: '{{.CMAKE_GENERATOR | default \"Ninja Multi-Config\"}}'\n  BUILD_TYPE: '{{.BUILD_TYPE | default \"Release\"}}'\n\ntasks:\n  configure:\n    dir: '{{.PROJECT_DIR}}'\n    cmds:\n      - \u003e\n        cmake -B build -S . -G \"{{.CMAKE_GENERATOR}}\" \\\n            -DCMAKE_BUILD_TYPE=\"{{.BUILD_TYPE}}\" \\\n            {{.CMAKE_ARGS}}\n\n  build:\n    dir: '{{.PROJECT_DIR}}'\n    cmds:\n      - task: configure\n      - 'cmake --build build --target \"{{.TARGET}}\"'\n\n  test:\n    dir: '{{.PROJECT_DIR}}'\n    cmds:\n      - task: build\n      - ctest --build-test --test-dir build\n\n```\n\n#### `Dockerfile`\n\n```Dockerfile\n# base image\nFROM abeimler/simple-cppbuilder as base\n\n# build stage\nFROM base as build\nCOPY . .\n#CMD [\"./my-build.sh\"]\nCMD [\"task\", \"build\"]\n```\n\n#### `docker-compose.yml`\n\n```yml\n---\nversion: '3.4'\n\nservices:\n  my-app-build:\n    build:\n      context: .\n      dockerfile: Dockerfile\n      target: build\n```\n\n```bash\n$ docker-compose up --build\n```\n\n\n## Environment Variables\n\n### `CC`\n\nC Compiler, default:  `gcc`.\nCan also be `clang`.  \n\n### `CXX`\n\nC++ Compiler, default:  `g++`.\nCan also be `clang++`.  \n\n### `CMAKE_GENERATOR`\n\nCMake Generator `cmake -G`, default: `Ninja`.\nCan also be `Unix Makefiles`.  \n\n### `BUILD_TYPE`\n\nCMake BuildType `-DCMAKE_BUILD_TYPE`, default: `Release`.\nCan also be `Debug`, `RelWithDebInfo` or `MinSizeRel`.  \n\n### `TARGET`\n\ntarget run by cmake `cmake --target`, default: `all`.  \n\n### `TOOLCHAIN_FILE`\n\nCMake Toolchain File `-DCMAKE_TOOLCHAIN_FILE`, default `./vcpkg/scripts/buildsystems/vcpkg.cmake`.  \n\n### `CMAKE_ARGS`\n\nCustom CMake Arguments, e.g. `-DENABLE_TESTING:BOOL=ON -DOPT_ENABLE_COVERAGE:BOOL=ON -DENABLE_DEVELOPER_MODE:BOOL=OFF`.  \n\n\n## More Environment Variables\n\nHere are some Environment Variables you can use in your build script, such as paths, scripts and programs.\n\n### `MAKE`\n\n`make` or `ninja`.\n\n### `PROJECT_DIR`\n\nProject-Home folder, `/home/project`.\n\n### `VCPKG_ROOT`\n\nPath to vcpkg, `/home/project/vcpkg`.\n\n### `VCPKG_TOOLCHAIN_FILE`\n\nvcpkg Toolchain, `/home/project/vcpkg/scripts/buildsystems/vcpkg.cmake`.\n\n\n### `CODECOV`\n\nPath to [codedov uploader](https://about.codecov.io/blog/introducing-codecovs-new-uploader/), `/home/codecov/codecov`.\n\n_(Used in CI/CD images)_\n\n\n### `VCPKG_DEFAULT_HOST_TRIPLET`, `VCPKG_DEFAULT_TRIPLET`\n\nvcpkg target- and host-triplet.\n\n_(Used in cross-compiler images)_\n\n### `VCPKG_CHAINLOAD_TOOLCHAIN_FILE`\n\nalternate CMake toolchain (for vcpkg)\n\n_(Used in cross-compiler images)_\n\n### `CROSS_TOOLCHAIN`\n\nPath to CMake Toolchain, `/home/cmake/x86_64-w64-mingw32.toolchain.cmake`.\n\n_(Used in cross-compiler images)_\n\n### `SETUP_ENV_SCRIPT`\n\nsource or setup-environment-script for cross compiler tools, `/usr/lib/emsdk/emsdk_env.sh` or `\t~/.cpprc`, ...\n\n_(Used in cross-compiler images)_\n\n### `EM_CACHE`, `EM_CONFIG`, `EMSCRIPTEN_PATH`, `EMSDK`, `EMSDK_PATH`\n\nPaths for emscripten, emsdk and configs.\n\n* `EM_CACHE`: `/usr/lib/emsdk/upstream/emscripten/cache`\n* `EM_CONFIG`: `/usr/lib/emsdk/.emscripten`\n* `EMSCRIPTEN_PATH`: `/usr/lib/emscripten`\n* `EMSDK`: `/usr/lib/emsdk`\n* `EMSDK_PATH`: `/usr/lib/emsdk`\n\n_(Used in emscripten images)_\n\n\n## License\n\nView [license information](https://github.com/abeimler/simple-cppbuilder/blob/main/LICENSE) for this image.  \n\nAs with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).  \n\nAs for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.\n\n\n### Links\n\n- [simple-cppbuilder DockerHub](https://hub.docker.com/r/abeimler/simple-cppbuilder)\n- [simple-cppbuilder GitHub](https://github.com/abeimler/simple-cppbuilder)\n- [cpp_starter_project](https://github.com/lefticus/cpp_starter_project)\n- [cpp_vcpkg_project](https://github.com/abeimler/cpp_vcpkg_project/tree/v2)\n- [cppdock](https://github.com/ricejasonf/cppdock)\n- Icon made by [me](https://hub.docker.com/u/abeimler) using C++-Icon made by [Freepik](https://www.freepik.com) from [Flaticon](https://www.flaticon.com/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeimler%2Fsimple-cppbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabeimler%2Fsimple-cppbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeimler%2Fsimple-cppbuilder/lists"}