further docker-ify the container definition and add a boot script

This commit is contained in:
Adam Brown 2015-01-26 20:07:01 -05:00
parent 59861bd039
commit 11828c2d2e
2 changed files with 37 additions and 30 deletions

View File

@ -2,33 +2,24 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
MAINTAINER Adam Brown "adamarthurryan@gmail.com" MAINTAINER Adam Brown "adamarthurryan@gmail.com"
# add a volume from the current folder
# ADD . /data
EXPOSE 8000
EXPOSE 9000
EXPOSE 3000
EXPOSE 35729
# add a user
RUN useradd -ms /bin/bash docker
# update package sources # update package sources
RUN apt-get -y update # and get some basics
RUN apt-get -y update && apt-get -y install \
build-essential \
libssl-dev \
curl \
git
# get some basics
RUN apt-get -y install build-essential libssl-dev curl
RUN apt-get install -y git
# install mongo db # install mongo db
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list
RUN apt-get update RUN apt-get update && apt-get install -y \
RUN apt-get install -y mongodb-org mongodb-org
# install node.js # install node.js
RUN apt-get -y install curl
RUN curl -sL https://deb.nodesource.com/setup | bash - RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs RUN apt-get install -y nodejs
@ -36,29 +27,42 @@ RUN apt-get install -y nodejs
RUN apt-get install -y ruby RUN apt-get install -y ruby
RUN gem install sass RUN gem install sass
# add a user
RUN useradd -ms /bin/bash docker
# switch to the docker user # switch to the docker user
ENV HOME /home/docker ENV HOME /home/docker
USER docker USER docker
RUN mkdir "${HOME}/.npm-packages" # configure npm to run without sudo permissions
RUN mkdir $HOME/.npm-packages
RUN echo 'prefix=${HOME}/.npm-packages' >> $HOME/.npmrc
RUN echo 'prefix=${HOME}/.npm-packages' >> ${HOME}/.npmrc ENV NPM_PACKAGES $HOME/.npm-packages
ENV NODE_PATH $NPM_PACKAGES/lib/node_modules:$NODE_PATH
ENV PATH $NPM_PACKAGES/bin:$PATH
ENV MANPATH $NPM_PACKAGES/share/man:$(manpath)
RUN echo '### Begin NPM config:'>> ${HOME}/.bashrc
RUN echo 'NPM_PACKAGES="${HOME}/.npm-packages"' >> ${HOME}/.bashrc
RUN echo 'NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"' >> ${HOME}/.bashrc
RUN echo 'PATH="$NPM_PACKAGES/bin:$PATH"' >> ${HOME}/.bashrc
RUN echo 'MANPATH="$NPM_PACKAGES/share/man:$(manpath)"' >> ${HOME}/.bashrc
RUN echo '### End NPM config:'>> ${HOME}/.bashrc
# install yeoman tooling and other npm packages # install yeoman tooling and other npm packages
# !!! this should be done for the docker user?
# !!! should configure npm to install to the user folder?
RUN npm install -g node-gyp RUN npm install -g node-gyp
RUN npm install -g yo bower grunt-cli RUN npm install -g yo bower grunt-cli
RUN npm install -g generator-webapp generator-angular generator-angular-fullstack RUN npm install -g generator-webapp generator-angular generator-angular-fullstack
# setup the mongo path
ENV MONGO_DB $HOME/.mongodb
ENV MONGO_LOG $HOME/.mongodb.log
RUN mkdir $MONGO_DB
# launch mongo
# RUN mongod --dbpath $MONGO_DB --logpath $MONGO_LOG --fork --journal
# add a volume from the current folder
# ADD . /data
# expose the ports
EXPOSE 8000
EXPOSE 9000
EXPOSE 3000
EXPOSE 35729

3
docker-run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker run -v ~/docker/data -p=8000:8000 -p=9000:9000 -p=3000:3000 -p=35729:35729 -it adamarthurryan/mean-dev