Sign inSign up

lparet/docker-ubuntu-angular

By lparet

Updated almost 8 years ago

This container needs an Angular project to work. It will download npm packages and build it.

Image
1

2.3K

lparet/docker-ubuntu-angular repository overview

= Docker container Angular

This repository contains configurations to create a Docker container with:

  • Ubuntu 16.04
  • Apache2
  • nodejs v9.+ and npm
  • yarn latest version
  • angular-cli latest version

This container needs an Angular project to work. At the running, it will download npm packages and build the project.

Like that, after few secondes/minutes, your Angular app works.

== Getting Started

=== Prerequisites

You have to install Docker and Docker Compose (optional) to build and run this container. You also need to have an Angular project to start this container.

=== Pull container

You can download this container from DockerHub by launching this command :

[source,bash]

docker pull lparet/docker-ubuntu-angular

It will download the latest version.

=== Run container

==== Prerequisites

Firstly, you have to plug an Angular project. To do that, you need to create a data volume between host and docker container:

  • Pull your project in a directory on your host.
  • Copy it path in docker-compose.yml and edit /path/to/your/project

.docker-compose.yml

services: docker-angular: image: lparet/docker-ubuntu-angular container_name: docker-angular restart: always volumes: - /path/to/your/project:/var/www/html:rw environment: - NG_BUILD_COMMAND="YOUR_CUSTOM_NG_BUILD_COMMAND"

You also can create an environment variable to choose if it's a production or prototype environment. In parallel, you have to set it in Angular application configuration. Please consult official documentation.

==== Running

You can use docker-compose.yml:

[source,bash]

docker-compose up -d

It will run your container with parameters specified in the file.

OR

You can use docker run command:

[source,bash]

docker run -it lparet/docker-ubuntu-angular --name ubuntu-angular -v /path/to/my/project:/var/www/html -e NG_BUILD_COMMAND="YOUR_CUSTOM_NG_BUILD_COMMAND"

=== Test your project

Open in your browser this URL http://localhost:80

OR

Consult Docker container logs

[source,bash]

docker logs docker-angular

OR

Go into the Docker container

[source,bash]

docker exec -it docker-angular bash

== Author

Louis Paret - [email protected]

Tag summary

Content type

Image

Digest

Size

221.8 MB

Last updated

almost 8 years ago

docker pull lparet/docker-ubuntu-angular