Skip to content

mappedinn/angular4-on-nginx-with-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker example for Angular4 running on Nginx

1. Creation of the angular4 application through command line

This project was generated with Angular CLI version 1.2.3.

The command used for that is:

sudo npm install -g @angular/cli
ng new angular4-on-nginx-with-docker

The installed npm packages are:

npm ls --depth=0
# [email protected] /home/amine/docker-project/angular4-on-nginx-with-docker/nginx/frontend
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @angular/[email protected]
# ├── @types/[email protected]
# ├── @types/[email protected]
# ├── @types/[email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# ├── [email protected]
# └── [email protected]

The angular application is working correctly through npm start

2. Compiling the angular4 application

ng build --prod

Probably, the compilation will not go as it should be. In this case, disable the AOT as follows:

ng build --prod --aot=false

3. Building the image and running the container

docker-compose up -d --build

4. Identification of the IP address of the container

docker inspect angular4onnginxwithdocker_nginx_1 | grep IPA
            "SecondaryIPAddresses": null,
            "IPAddress": "",
                    "IPAMConfig": null,
                    "IPAddress": "172.18.0.2",

Open your browser on 172.18.0.2

About

angular4-on-nginx-with-docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published