From 9a7dc3c1384edbaf9841a06f43fa3b15401f5bd8 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Apr 2015 13:22:55 -0400 Subject: [PATCH] add docker definition and launch scripts --- docker/Dockerfile | 5 ++++- docker/README.md | 18 ++++++------------ docker/{mean => prepare.sh} | 2 +- launch-devel.sh | 21 +++++++++++++++++++++ launch-production.sh | 21 +++++++++++++++++++++ 5 files changed, 53 insertions(+), 14 deletions(-) rename docker/{mean => prepare.sh} (90%) mode change 100755 => 100644 create mode 100755 launch-devel.sh create mode 100755 launch-production.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index b448301..6aee4d1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,6 +18,9 @@ RUN apt-get install -y nodejs # install ruby RUN apt-get install -y ruby1.9.1 ruby1.9.1-dev +# install wdiff +RUN apt-get install -y wdiff + # add a user # and make them a sudoer RUN useradd -ms /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo @@ -45,4 +48,4 @@ VOLUME /home/docker # EXPOSE 8000 # EXPOSE 9000 # EXPOSE 3000 -# EXPOSE 35729 \ No newline at end of file +# EXPOSE 35729 diff --git a/docker/README.md b/docker/README.md index de59f0e..a7a8003 100755 --- a/docker/README.md +++ b/docker/README.md @@ -1,21 +1,15 @@ -# docker-mean-dev +# wdiff-markdown/docker -A docker container for developing mean stack applications +A docker container for deploying the wdiff-markdown application Usage ====== -Build the container with `docker build -t 'adamarthurryan/mean' .`. Install the `mean` and `start-mongodb` to `~/bin` or some other location in the path. +Build the container with `docker build -t 'adamarthurryan/wdiff-markdown'`. -To run commands from the container, use `mean `. For example, to install a new npm package globally: +Run the script `prepare.sh` from this folder. - mean npm install -g generator-polymer +To launch the application in development mode, run `launch-devel.sh`. -Or to create a yeoman scaffolding in the current folder: - - mean yo polymer - -Some default npm and gem packages are specified in `default-packages.sh`. They can be installed with: - - mean bash default-packages.sh +To launch the application in production mode, run `launch-prod.sh`. diff --git a/docker/mean b/docker/prepare.sh old mode 100755 new mode 100644 similarity index 90% rename from docker/mean rename to docker/prepare.sh index 3dfe8de..c0637d3 --- a/docker/mean +++ b/docker/prepare.sh @@ -16,4 +16,4 @@ if docker inspect -f {{.Name}} data-docker-home > /dev/null fi -docker run -it --rm --volumes-from=data-docker-home -v ${PWD}:/working -w /working -p 9000:9000 -p 35729:35729 adamarthurryan/mean $@ \ No newline at end of file +docker run -it --rm --volumes-from=data-docker-home -v ${PWD}:/working -w /working adamarthurryan/mean bash default-packages.sh diff --git a/launch-devel.sh b/launch-devel.sh new file mode 100755 index 0000000..0da31c4 --- /dev/null +++ b/launch-devel.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# launch the mean docker container to execute a single command on the working directory +# the working directory will be mounted as /working in the docker container + + +# test if the data-docker-home container has been created +if docker inspect -f {{.Name}} data-docker-home > /dev/null + then + echo > /dev/null + else + echo "* creating data-docker-home container" + echo + # The data container has a volume at /home/docker, is named 'data' and is based on busybox + docker create -v /home/docker --name data-docker-home adamarthurryan/mean echo "Data container - docker home" + +fi + +docker/start-mongodb + +docker run -it --rm --link mongodb:mongodb --volumes-from=data-docker-home -v ${PWD}:/working -w /working -p 9000:9000 -p 35729:35729 adamarthurryan/mean grunt serve diff --git a/launch-production.sh b/launch-production.sh new file mode 100755 index 0000000..e623cb6 --- /dev/null +++ b/launch-production.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# launch the mean docker container to execute a single command on the working directory +# the working directory will be mounted as /working in the docker container + + +# test if the data-docker-home container has been created +if docker inspect -f {{.Name}} data-docker-home > /dev/null + then + echo > /dev/null + else + echo "* creating data-docker-home container" + echo + # The data container has a volume at /home/docker, is named 'data' and is based on busybox + docker create -v /home/docker --name data-docker-home adamarthurryan/mean echo "Data container - docker home" + +fi + +docker/mongodb-start + +docker run -it --rm --link mongodb:mongodb -e "PORT=8080" --volumes-from=data-docker-home -v ${PWD}:/working -w /working -p 80:8080 adamarthurryan/mean grunt serve:dist