{"id":23236786,"url":"https://github.com/pratikpc/cpp-builder-docker","last_synced_at":"2026-01-18T19:06:43.465Z","repository":{"id":125288358,"uuid":"374530541","full_name":"pratikpc/cpp-builder-docker","owner":"pratikpc","description":"Use CMake, Ninja \u0026 VCPKG to build Docker images","archived":false,"fork":false,"pushed_at":"2021-06-07T11:24:59.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-02-12T00:38:49.304Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/pratikpc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-07T04:08:35.000Z","updated_at":"2025-02-11T04:20:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"abc3f2c0-9c9e-4f8b-b87d-d6d3f9f00bf8","html_url":"https://github.com/pratikpc/cpp-builder-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fcpp-builder-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fcpp-builder-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fcpp-builder-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fcpp-builder-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratikpc","download_url":"https://codeload.github.com/pratikpc/cpp-builder-docker/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399897,"owners_count":20932881,"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":[],"created_at":"2024-12-19T04:12:45.006Z","updated_at":"2026-01-18T19:06:43.420Z","avatar_url":"https://github.com/pratikpc.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C++ Docker Builder\n\n# Uses\n\n1. [CMake](https://cmake.org/)\n2. [VCPKG](https://github.com/microsoft/vcpkg)\n3. [Ninja](https://ninja-build.org/)\n4. [GCC](https://gcc.gnu.org/)\n5. [Clang](https://clang.llvm.org/) (installed already. User can configure using CMake)\n\n# What you need to install?\n\n1. Docker alone  \n   Using Docker, the rest of the process is handled by the image.\n\n# I know it works on Linux. But does it work on Windows?\nYes it does work on Windows  \nAll you need to do is install [Docker Desktop](https://www.docker.com/products/docker-desktop)  \nThe generated items are Linux based.  \nSo for quite a few projects, this could replace your need for VMs.  \n\n# Simplest usage sample\n\n1. For this, we recommend using a docker-compose file.\n2. Using Docker Compose, we can create a volume\n3. To store\n   - build data\n   - VCPKG\n4. Run commands easily\n5. Share data easily\n\n# Docker-Compose usage\n\n## Downloading VCPKG/Updating it\n\nBy default, our images don't ship with VCPKG  \nThis is because by the time you use it, you might want newer, more updated vcpkg  \nHence, run this very simple command.  \nThis command installs VCPKG if absent, or updates it.  \nRun `docker compose run --rm vcpkg`\n\n---\n## Run CMake\n\nIf you just want to run CMake and find out the version  \nRun `docker compose run --rm cmake --version`\n\n---\n## Generate CMake\n\nTo generate CMake Ninja build,\nRun `docker compose run gen`  \nTo pass commands to CMake Generator,  \n(Like variables)  \nRun `docker compose run gen -DENABLE_TEST=\"\"`  \nYou can add configuration options to select C++ Compilers etc.\n``\n\n---\n## Build\n\nTo build,  \nRun `docker compose run build`\n\n---\n## VCPKG\n\nTo run VCPKG,  \nAnd view the version  \nRun `docker compose run --rm run-vcpkg version`\n\n---\n## Run tests\n\nTo run CTests,  \nRun `docker compose run --rm ctest`\n\n---\n## Run generated Code\n\nTo run your generated code  \nYou can  \nRun `docker compose run --rm execute /build/sample/sample`  \nTo make it even easier,  \nYou can make a small configuration in your Docker Compose\n```yaml\n  run-sample:\n    image: fedora\n    entrypoint: /build/sample/sample\n    volumes:\n      - vcpkg:/vcpkg\n      - build:/build\n```\nAfter adding this configuration,  \nYou can run it simply with  \nRun `docker compose run --rm run-sample-parser`\n\n# [Docker-Compose file](sample/docker-compose.yml)\n\n```yaml\nversion: \"3.7\"\nservices:\n  cmake:\n    image: ghcr.io/pratikpc/cpp-builder-docker/cmake:latest\n  vcpkg:\n    image: ghcr.io/pratikpc/cpp-builder-docker/vcpkg:latest\n    volumes:\n      - vcpkg:/vcpkg\n  gen:\n    image: ghcr.io/pratikpc/cpp-builder-docker/gen:latest\n    volumes:\n      - vcpkg:/vcpkg\n      - build:/build\n      - ./:/source\n  build:\n    image: ghcr.io/pratikpc/cpp-builder-docker/build:latest\n    volumes:\n      - vcpkg:/vcpkg\n      - build:/build\n      - ./:/source\n  ctest:\n    image: ghcr.io/pratikpc/cpp-builder-docker/ctest:latest\n    volumes:\n      - build:/build\n  execute:\n    image: fedora\n    volumes:\n      - vcpkg:/vcpkg\n      - build:/build\n  run-vcpkg:\n    image: fedora\n    entrypoint: vcpkg/vcpkg\n    volumes:\n      - vcpkg:/vcpkg\nvolumes:\n  vcpkg: {}\n  build: {}\n```\n\n# Why Fedora?\n\n1. We have quite a few dependencies\n2. They are fairly popular\n3. Ubuntu packages are usually not up to date.\n4. Installing without Package Manager might require manual intervention.\n5. So it was noticed that it would be far easier to\n6. Rely on a distro known to update their packages\n7. The newer compilers come with newer features, newer updates etc.\n\n# Deployment\n\n1. The images are deployed on GitHub Container Registry\n2. The deployment process is automated using GitHub Actions and runs every month\n3. If you seek an update more quickly, you can always create a PR or contact me\n\n# Recommended usage\n\n1. We would recommend you to\n2. Follow Modern CMake Practices\n3. Use VCPKG.json to manage your packages.\n4. As we already set the project to use VCPKG toolchain file\n5. Using vcpkg.json would allow vcpkg to\n   1. Respect your configuration settings\n   2. Make it easy for you to set your own configuration\n   3. Make distribution easy\n   4. Make project versioning easy\n   5. For further details, check VCPKG website\n\n# I want to install additional packages to the base (CMake) image\n1. I expect the need would not be felt when it comes to VCPKG based packages\n2. In such a scenario as this when you wish to modify the CMake package,  \n\nUse Dockerfile to attain that\n```Dockerfile\nFROM ghcr.io/pratikpc/cpp-builder-docker/cmake:latest\nRUN dnf install \u003cpackage-names\u003e\n```\nAnd then update the rest of the packages in your fork because all images except VCPKG ones depend on the CMake base image\n\n# I want to install additional packages to the Build image\nUse Dockerfile to attain that\n```Dockerfile\nFROM ghcr.io/pratikpc/cpp-builder-docker/build:latest\nRUN dnf install \u003cpackage-names\u003e\n```\nAnd then in your Docker Compose file, replace our build image with yours\n\n# Contact me\nYou can contact me [via LinkedIn](https://www.linkedin.com/in/pratik-chowdhury-889bb2183/)  \nOr you can create a GitHub Issue!\n\n# [Sample C++ Library with implementation](/pratikpc/rss-parser-cxx)\nI have created a simple C++ RSS Parser header only library.  \nThe library contains a sample file and a CTest Unit test sample.  \nI have added a Docker Compose file there  \nYou can [check it out](/pratikpc/rss-parser-cxx)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikpc%2Fcpp-builder-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratikpc%2Fcpp-builder-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikpc%2Fcpp-builder-docker/lists"}