https://github.com/royling/docker-mean
Set up MEAN workspace using docker
https://github.com/royling/docker-mean
Last synced: 8 months ago
JSON representation
Set up MEAN workspace using docker
- Host: GitHub
- URL: https://github.com/royling/docker-mean
- Owner: royling
- License: mit
- Created: 2015-12-27T03:19:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T08:20:55.000Z (about 9 years ago)
- Last Synced: 2024-10-18T05:58:08.522Z (over 1 year ago)
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Docker for development with MEAN stack
### Build image:
```sh
docker build -t royling/mean-dev -f ./Dockerfile ./
```
### Use image to set up workspace:
1. Start a one-off container to scaffold app with [_generator-angular-fullstack_](https://github.com/angular-fullstack/generator-angular-fullstack):
```sh
docker run -it --rm --name scaffolding -v $PWD:/workspace royling/mean-dev yo angular-fullstack Hello
```
NOTE: `open` grunt task is not supported from a docker, so need to modify the scaffolded `Gruntfile.js` first:
```js
grunt.task.run([
'clean:server',
'env:all',
'concurrent:pre',
'concurrent:server',
'injector',
'wiredep:client',
'postcss',
'express:dev',
'wait',
//'open',
'watch'
]);
```
2. Install node modules && bower modules:
```sh
docker run -it --rm --name install_modules -v $PWD:/workspace royling/mean-dev npm install && bower install
```
3. Start MongoDB with official mongo image:
```sh
docker run --name mongodb -d -p 27017:27017 mongo
```
4. Modify configuration(`server/config/environment/development.js`) to connect to mongodb container:
```js
mongo: {
uri: 'mongodb://mongodb/workspace-dev'
},
```
5. Run `grunt:serve`, linking to mongodb container:
```sh
docker run -it --name web -v $PWD:/workspace -p 9000:9000 --link mongodb royling/mean-dev grunt serve
```
6. Open your browser and go to `http://localhost:9000`, start your work!
For MacOS/Windows users, use the ip of VM which docker runs on.