Skip to content

Commit

Permalink
コンテナ起動時に /var/src をカレントディレクトリになるように修正
Browse files Browse the repository at this point in the history
コンテナ起動時にいちいち cd /var/src するのが面倒なので、Dockerfile 側で
WORKDIR /var/src を指定しました。
  • Loading branch information
kariya-mitsuru committed Jun 8, 2018
1 parent 010e4cb commit ad88f82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ DOCKER_RM=${DOCKER_RM---rm}

case "$1" in
"build" ) docker build -t kunai:0.0.0-alpine docker ;;
"install" ) docker run $DOCKER_RM -v `pwd`:/var/src $DOCKER_IT kunai:0.0.0-alpine /bin/sh -c "cd /var/src && exec npm install $NPM_OPTS" ;;
"install" ) docker run $DOCKER_RM -v `pwd`:/var/src $DOCKER_IT kunai:0.0.0-alpine npm install $NPM_OPTS ;;
"run" )
if [ $# -lt 2 ]; then
show_help
exit 1
fi
docker run $DOCKER_RM -v `pwd`:/var/src -p 8080:8080 $DOCKER_IT kunai:0.0.0-alpine /bin/sh -c "cd /var/src && exec npm run $2" ;;
docker run $DOCKER_RM -v `pwd`:/var/src -p 8080:8080 $DOCKER_IT kunai:0.0.0-alpine npm run $2 ;;
* )
show_help
exit 1 ;;
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
FROM node:8.9.0-alpine

WORKDIR /var/src

0 comments on commit ad88f82

Please sign in to comment.