https://github.com/naologic/bo11-dev-docker
Bo11 run locally
https://github.com/naologic/bo11-dev-docker
naologic
Last synced: 5 months ago
JSON representation
Bo11 run locally
- Host: GitHub
- URL: https://github.com/naologic/bo11-dev-docker
- Owner: naologic
- Created: 2020-04-07T10:01:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-10T11:39:01.000Z (about 6 years ago)
- Last Synced: 2025-08-13T21:45:25.683Z (11 months ago)
- Topics: naologic
- Language: Dockerfile
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bo11 Angular
Docker image for Angular CLI to use as build container.
Image on dockerhub:

Currently this image uses node 12 (npm 6) and node:lts-slim as base distribution.
The AngularCLI analytics feature is disabled by default to avoid problems in CI environments.
If you want to opt-in, set the `NG_CLI_ANALYTICS` environment variable to an empty value.
## Example usage
```
docker run -u $(id -u) --rm -v "$PWD":/app naologic/bo11-dev-docker ng new MyDemo
cd MyDemo
docker run -u $(id -u) --rm -v "$PWD":/app naologic/bo11-dev-docker ng build
```
To run the Angular CLI development server from docker you need to map the port and instruct Angular CLI to listen on all interfaces.
For example use
```
cd MyDemo
docker run -u $(id -u) --rm -p 4200:4200 -v "$PWD":/app naologic/bo11-dev-docker ng serve --host 0.0.0.0
```
If you want to clone additional git repositories, f.e. from package.json, and you run with a different user than uid 1000 you need to mount the passwd since git requires to resolve the uid.
```
docker run -u $(id -u) --rm -p 4200:4200 -v /etc/passwd:/etc/passwd -v "$PWD":/app naologic/bo11-dev-docker npm install
```
## using yarn
This image contains yarn preinstalled and can be used as alternative package manager.
If you want to use a shared cache directory for yarn, you will need to mount the directory into the image.
### New project with yarn
```
docker run -u $(id -u) --rm -v "$PWD":/app naologic/bo11-dev-docker sh -c "ng set --global packageManager=yarn; ng new MyDemoProject"
```
Note the Angular CLI docker container instance is removed after each execution, therefore the selection of the package manager will just influence the current execution.
### Using a shared cache
You can use the regular yarn cache directory or specify a different directory.
Make sure that you already have the cache directory initialized before using it with this docker image, otherwise the permissions might end up wrong.
Using the regular yarn directory, which should be the right choice when using during regular development:
```
docker run -u $(id -u) --rm -v "$HOME/.cache/yarn":/tmp/.cache/yarn -v "$PWD":/app naologic/bo11-dev-docker sh -c "ng set --global packageManager=yarn; ng new MyDemoProject"
```
Assuming you have a directory "../yarn-cache" with appropriate access rights, you can use it to create a new project using the following command
```
docker run -u $(id -u) --rm -v "$PWD/../yarn-cache":/tmp/.cache/yarn -v "$PWD":/app naologic/bo11-dev-docker sh -c "ng set --global packageManager=yarn; ng new MyDemoProject"
```
For subsequent package installations (f.e. in a CI build) just use `yarn` instead of `npm`.
### Offline mode
This requires the use of a shared cache and a `yarn.lock` file from a previous yarn package installation run.
```
cd MyDemoProject
docker run -u $(id -u) --rm -v "$PWD/../../yarn-cache":/tmp/.cache/yarn -v "$PWD":/app naologic/bo11-dev-docker yarn install --offline
```