- Docker (https://docs.docker.com/install/)
- An image registry like Docker Hub (https://hub.docker.com/)
- Access to a Pivotal Build Service Instance
- Pivotal Network User Account (https://network.pivotal.io)
- pks CLI (https://docs.pivotal.io/pks/1-7/installing-pks-cli.html) (optional)
- Download and install the
pb
CLI from Pivotal Network https://network.pivotal.io/products/build-service
mv pb-0.1.0-darwin pb
chmod +x pb
sudo mv pb /usr/local/bin
- To get access you will need to get kubeconfig access to the cluster where PBS is running. You can do this most easily with the pks cli:
pks get-kubeconfig production -a <build-service-api> -u <YOUR_USERNAME> -p <YOUR_PASSWORD> -k
- Create a project
pb project create sample-project
- Set the project as a target
pb project target sample-project
- Create a
registry-secret.yaml
file with your push credentials for the docker registry based on the2-registry-secret.yaml
file below and and apply
pb secrets registry apply -f registry-secret.yaml
- Create a
repository-secret.yaml
file with your credentials for the git repository based on the3-repository-secret.yaml
file below and and apply
pb secrets git apply -f repository-secret.yaml
-
Fork the sample repository https://github.com/buildpack/sample-java-app to test the automatic rebuild functionality
-
Create a PBS image configuration file (
image.yaml
) with your forked repository based on the4-image.yaml
file below and apply
pb image apply -f image.yaml
- View all builds for the image and wait until the status is SUCCESS
pb image builds index.docker.io/<docker-registry-username>/pbs-sample-java-app:latest
(Optional) View logs from the first build for the image:
pb image logs index.docker.io/<docker-registry-username>/pbs-sample-java-app:latest -b 1
- Push any update to the forked sample app repository. Pivotal Build Service should recognize the update and automatically rebuild your image.
You can see this for example by viewing the builds(step #11)
- Run the latest image of the app locally with docker
docker run -p 8080:8080 <docker-registry-username>/pbs-sample-java-app
-
Open localhost:8080 in your favorite browser
-
Delete project and all associated resources
pb image delete index.docker.io/<docker-registry-username>/pbs-sample-java-app:latest
pb project delete sample-project