Deploy Angular apps to CloudFoundry using the Angular CLI
-
Install the latest version of Angular cli
yarn global add @angular/cli
-
Create a new Angular project
ng new hello-world --defaults cd hello-world
-
Add
ng-deploy
to your projectng add ng-deploy-cloudfoundry
-
Deploy your project to CloudFoundry.
ng run hello-world:deploy
To use the Cloud Foundry deploy command you need the Cloud Foundry CLI, Angular CLI and an Angular project (v8.3.0 or greater)
- If you don't have the cf CLI installed, follow these instructions
- Run
ng --version
to check the version, you need version 8 or greater of the Angular CLI - If necessary upgrade your project with
ng update @angular/cli @angular/core
You can adjust your deployment with options.
The available options are:
--configuration
(-c
) - A named build target, as specified in the "configurations" section of angular.json--no-build
- Skip build process during deployment--random-route
- Generate a random unique route for the deployed application
Example:
ng deploy --no-build --random-route