Skip to content

Commit

Permalink
docker link db
Browse files Browse the repository at this point in the history
  • Loading branch information
lau-jay committed Jul 2, 2017
1 parent 5a22a7f commit ee5be29
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ A programming community

# dev
## using docker
- chanage ./config/plugin.js `mongodb://localhost:27017/community` to `mongodb://mongo:27017/community`
- `docker pull node:8-alpine`
- `bash rundev.sh`

Expand Down
138 changes: 127 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion rundev.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

DB=community-db
# node:latest 换成node:8-alpine
docker run \
--rm \
--name community\
-i \
-v $(pwd):/app \
-p 5002:3000 \
--link $DB:mongo \
node:8-alpine \
/bin/sh -c "cd /app && npm i --registry=https://registry.npm.taobao.org && npm run dev"
4 changes: 3 additions & 1 deletion rundevdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ NAME=community-db
PORT_OUT=27017
PORT_IN=27017

IMAGE=mongo:3.2.10
# 建议改成3.2.10
IMAGE=mongo:latest

docker run \
--rm \
-d \
--name $NAME\
-v $(pwd)/../community.storage:/data/db \
-p $PORT_OUT:$PORT_IN \
Expand Down

0 comments on commit ee5be29

Please sign in to comment.