The first thing we need to do is to generate a docker image and push it to any registry. We will use the DockerHub registry for this example.
You can use any Docker Registry that you want, either DockerHub, any private Docker Registry, or GCR. If you want more information about how to deploy from any of this registries you should check this link
Register to DockerHub
Once logged in, create a repository for each image. The field Name is the name of the docker image. This is the identifier along with the account name.
After that, login to the registry with your docker cli by typing
docker login in your shell (terminal window).
Now you are ready to push your image to DockerHub repository using
Once the script finishes, the docker image is published to DockerHub and ready to be deployed.
Docker Image Implementation
Dockerfile is implemented using MultiStage build:
The build stage extends
FROM maven:alpine. The single responsibility of this stage is to install dependencies (caching layers) and generate the jar.
The runtime stage extends
FROM openjdk:alpine and works executing the jar generated by build stage. It will
EXPOSE the external ports to the host.
Now that the images pushed to DockerHub, push them into Pivotal Platform.
The first requirement is to create an account in Pivotal. Obtain access to the console and then create an organization manually. It's as simple as entering input inside Create an Org.
The next step is to install the CF CLI in our computer. There is a guide to help you with this that is provided by your platform. See PCF CLI Install
Once the Cloud Foundry CLI is installed on your machine, login to your Pivotal account:
$ cf login -a https://api.run.pivotal.io
A Cloud Foundry connection is established using your Pivotal account. Copy the
example-manifest.yml to your project and rename it to
manifest.yml. Open the manifest file and edit the three configurable variables:
service_name: The name of the service inside the Pivotal Cloud Foundry platform.
docker_image: The docker image name is composed with your account and the repository (e.g: vlingo/project1)
subdomain: This is your public end-point within domain
You may also configure environment variables, instances, memory, disk quota, etc. See Deploying with Application Manifests for possible manifest configurations.
Along with your configured
manifest.yml, push your project:
$ cf push
This command by default checks whether a
manifest.ymlexists in the directory, and if so, uses it to push to the platform.
That's all it takes! The service/application is in the Pivotal Cloud Foundry, deployed and working. Use the Pivotal Console to see your services, the logs, and any other project infrastructure artifacts.
See the vlingo-examples repository for a working configuration. This demonstrates how to integrate two or more services that are deployed to the Pivotal Cloud Foundry platform. View the vlingo-http-frontservice and vlingo-http-backservice as microservices, and the DEPLOY.md for further instructions.