Sign inSign up

rapid7/pip

By rapid7

•Updated about 4 years ago

Cloud Native Buildpack for installing pip with support for all stacks

Image
0

311

rapid7/pip repository overview

⁠rapid7/pip

This is a clone of the paketo-buildpacks/pip buildpack with support for all stacks. The buildpack.toml file is modified as shown below, but no other changes were made.

Repo url: https://github.com/paketo-buildpacks/pip⁠

⁠What is a buildpack?

See: https://buildpacks.io⁠

⁠How to use this buildpack

⁠Clone the paketo samples repo

This contains sample applications for different languages that can be used to app containers.

git clone https://github.com/paketo-buildpacks/samples.git

We will be using the example app located here: samples/python/pip

⁠Build a container using this buildpack on a custom amazonlinux stack

The amazonlinux builder does not include any buildpacks, so we need to specify all buildpacks.

--env BP_LOG_LEVEL=DEBUG enables configure and make output (omit for less verbose build)

pack build pip-sample --path samples/python/pip \
  --builder rapid7/amazonlinux-builder:base \
  --buildpack rapid7/cpython:latest \
  --buildpack rapid7/pip:latest \
  --buildpack paketo-buildpacks/pip-install \
  --buildpack paketo-buildpacks/python-start \
  --buildpack paketo-buildpacks/procfile \
  --env BP_LOG_LEVEL=DEBUG \
  --env BP_CPYTHON_VERSION=3.10.6 \
  --env BP_CPYTHON_CONFIGURE_FLAGS="--enable-optimizations --with-ensurepip --enable-loadable-sqlite-extensions"

⁠Show the buildpacks used to build the container

pack inspect pip-sample

⁠Verify the app container works

The sample app is a flask web app with gunicorn web server.

See samples/python/pip/README.md for instructions on running the container.

⁠Verify the container has the required modules installed

docker run --rm -it --entrypoint launcher pip-sample python -m pip list

⁠How this was built

# Clone the paketo-buildpacks/pip repo and build binaries (assumes go is installed)
git clone [email protected]:paketo-buildpacks/pip.git
cd pip
./scripts/build.sh

mkdir to-be-packaged

# Move the buildpack binaries to the to-be-packaged directory
mv bin to-be-packaged/

# Create a package.toml file that points to the current directory
cat <<EOF > to-be-packaged/package.toml
[buildpack]
uri = "file://./"
EOF

# Add version and update all stacks lists to use "*"
cat buildpack.toml | yj -tj | jq '.buildpack += {version: "9.9.9"} | . + {stacks: [{id: "*"}]} | . |= (.metadata.dependencies[] += (.metadata.dependencies[] | .stacks = ["*"]))' | yj -jt > to-be-packaged/buildpack.toml

cd to-be-packaged

# Create a buildpack image and publish it to docker hub
pack buildpack package rapid7/pip:latest --config package.toml --publish

# Clean up so there are no changes in the repo
cd .. && rm -r to-be-packaged

Tag summary

Content type

Image

Digest

sha256:bd9940858…

Size

8.8 MB

Last updated

about 4 years ago

docker pull rapid7/pip