add docker definition and launch scripts

This commit is contained in:
Adam Brown 2015-04-17 13:22:55 -04:00
parent 3bf6223c92
commit 9a7dc3c138
5 changed files with 53 additions and 14 deletions

View File

@ -18,6 +18,9 @@ RUN apt-get install -y nodejs
# install ruby # install ruby
RUN apt-get install -y ruby1.9.1 ruby1.9.1-dev RUN apt-get install -y ruby1.9.1 ruby1.9.1-dev
# install wdiff
RUN apt-get install -y wdiff
# add a user # add a user
# and make them a sudoer # and make them a sudoer
RUN useradd -ms /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo RUN useradd -ms /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo
@ -45,4 +48,4 @@ VOLUME /home/docker
# EXPOSE 8000 # EXPOSE 8000
# EXPOSE 9000 # EXPOSE 9000
# EXPOSE 3000 # EXPOSE 3000
# EXPOSE 35729 # EXPOSE 35729

View File

@ -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 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 <command>`. 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: To launch the application in production mode, run `launch-prod.sh`.
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

2
docker/mean → docker/prepare.sh Executable file → Normal file
View File

@ -16,4 +16,4 @@ if docker inspect -f {{.Name}} data-docker-home > /dev/null
fi fi
docker run -it --rm --volumes-from=data-docker-home -v ${PWD}:/working -w /working -p 9000:9000 -p 35729:35729 adamarthurryan/mean $@ docker run -it --rm --volumes-from=data-docker-home -v ${PWD}:/working -w /working adamarthurryan/mean bash default-packages.sh

21
launch-devel.sh Executable file
View File

@ -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

21
launch-production.sh Executable file
View File

@ -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