This application is a simple example of how to use Docker + Angular + Ansible. This simple application uses Docker to containerize an Angular app and uses Ansible to load and configure the build/distribution of the Angular application.
-
Build Docker Image To build the Docker image use the following:
docker image build -t ubuntu-angular .
-
Run the docker container Run the docker contianer:
docker run -d -p 80:80 ubuntu-angular
-
Run app locally To run the Angular application locally, navigate inside the site directory and use:
ng serve
-
Docker Installs Docker installs the ubuntu container and things like apache, ansible, and nodejs.
-
Ansible Configurations Ansible removes the node_modules, runs npm install, packages the Angular app, and copies the distribution site to the /var/www/html directory.
-
Apache Serves App Apache serves the application on port 80.