https://github.com/miclip/cpp-buildpack
A very simple example of a custom buildpack for C++
https://github.com/miclip/cpp-buildpack
Last synced: 2 months ago
JSON representation
A very simple example of a custom buildpack for C++
- Host: GitHub
- URL: https://github.com/miclip/cpp-buildpack
- Owner: miclip
- Created: 2022-06-27T20:02:04.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-29T18:08:59.000Z (almost 3 years ago)
- Last Synced: 2025-02-05T02:38:54.791Z (4 months ago)
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple C++ Custom Buildpack
An example paketo custom buildpack to compile c++ code. As the `g++` compiler is present on the base images no dependencies are required. https://github.com/paketo-buildpacks/base-stack-release/blob/1.2.1/build-receipt
## Usage
~~~sh
mkdir ./cpp-sample
cat > "./cpp-sample/main.cpp" << EOL
#include
int main()
{
std::cout << "Hello World\n";
return 0;
}
EOL# test app
g++ -o out -I ./cpp-sample/ cpp-sample/*.cpp
./out
# should print "Hello World"# clone buildpack locally
git clone [email protected]:miclip/cpp-buildpack.git# execute build...
pack build test-cpp --path ./cpp-sample --buildpack ./cpp-buildpack --builder paketobuildpacks/builder:base# test image
docker run test-cpp~~~
## Use in Tanzu Build Service
~~~sh
# package and publish buildpack image
pack buildpack package gcr.io/some-project/custom-buildpacks/cpp-buildpack -f image -p ./cpp-buildpack --publish# add to cluster store
kp clusterstore add default -b gcr.io/some-project/custom-buildpacks/cpp-buildpack:1.0.0# create a builder
kp builder save cpp-test -b cpp-buildpack -n builds -s base --store default --tag gcr.io/some-project/custom-builders/cpp-builder# create image resource
kp image save cpp-sample -n builds --git https://github.com/miclip/cpp-sample.git --git-revision master -b cpp-test --tag gcr.io/some-project/tbs-examples/cpp-sample# test image
docker run gcr.io/some-project/tbs-examples/cpp-sample
Hello World~~~