add questionable run script \n update readme
This commit is contained in:
parent
b385c233b6
commit
4562152a20
55
Dockerfile
Executable file → Normal file
55
Dockerfile
Executable file → Normal file
@ -11,13 +11,6 @@ RUN apt-get -y update && apt-get -y install \
|
|||||||
curl \
|
curl \
|
||||||
git
|
git
|
||||||
|
|
||||||
|
|
||||||
# install mongo db
|
|
||||||
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 apt-get update && apt-get install -y \
|
|
||||||
mongodb-org
|
|
||||||
|
|
||||||
# install node.js
|
# install node.js
|
||||||
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
|
||||||
@ -26,15 +19,16 @@ 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
|
# add a user
|
||||||
RUN useradd -ms /bin/bash docker
|
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
|
||||||
|
|
||||||
# configure npm to run without sudo permissions
|
# 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 NPM_PACKAGES $HOME/.npm-packages
|
||||||
@ -42,40 +36,27 @@ ENV NODE_PATH $NPM_PACKAGES/lib/node_modules:$NODE_PATH
|
|||||||
ENV PATH $NPM_PACKAGES/bin:$PATH
|
ENV PATH $NPM_PACKAGES/bin:$PATH
|
||||||
ENV MANPATH $NPM_PACKAGES/share/man:$(manpath)
|
ENV MANPATH $NPM_PACKAGES/share/man:$(manpath)
|
||||||
|
|
||||||
|
|
||||||
# install yeoman tooling and other npm packages
|
# install yeoman tooling and other npm packages
|
||||||
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 generator-polymer
|
||||||
|
|
||||||
# setup the mongo path
|
# #create a data volume
|
||||||
ENV MONGO_DB $HOME/.mongodb
|
# actually, let's just leave this to the command line
|
||||||
ENV MONGO_LOG $HOME/.mongodb.log
|
# VOLUME /data
|
||||||
RUN mkdir $MONGO_DB
|
|
||||||
|
|
||||||
# launch mongo
|
|
||||||
# this just preps the database - it still needs to be launched inside the docker container
|
|
||||||
RUN mongod --dbpath $MONGO_DB --logpath $MONGO_LOG --fork --journal
|
|
||||||
|
|
||||||
# create a script for launching mongo from the docker container
|
|
||||||
# this could go in .bashrc or something
|
|
||||||
# perhaps mongo should use the /data volume for its database?
|
|
||||||
RUN mkdir $HOME/bin
|
|
||||||
RUN echo 'mongod --dbpath $MONGO_DB --logpath $MONGO_LOG --fork --journal' > $HOME/bin/mongod-start
|
|
||||||
RUN chmod +x $HOME/bin/mongod-start
|
|
||||||
ENV PATH $PATH:$HOME/bin
|
|
||||||
|
|
||||||
# create a data volume
|
|
||||||
VOLUME /data
|
|
||||||
|
|
||||||
# expose the ports
|
|
||||||
EXPOSE 8000
|
|
||||||
EXPOSE 9000
|
|
||||||
EXPOSE 3000
|
|
||||||
EXPOSE 35729
|
|
||||||
|
|
||||||
|
# #expose the ports
|
||||||
|
# actually, let's just leave this to the command line
|
||||||
|
# EXPOSE 8000
|
||||||
|
# EXPOSE 9000
|
||||||
|
# EXPOSE 3000
|
||||||
|
# EXPOSE 35729
|
||||||
|
|
||||||
# configure git
|
# configure git
|
||||||
git config --global push.default simple
|
RUN git config --global push.default simple
|
||||||
|
RUN git config --global credential.helper cache
|
||||||
|
RUN git config --global credential.helper 'cache --timeout=43200'
|
||||||
|
|
||||||
# !!! how to securely configure the username / password?
|
# it would be nice if npm packages could be shared between instances...
|
||||||
|
# however it is difficult to both: add global packages from the Dockerfile
|
||||||
|
# and at the same time have the packages saved in a volume
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
docker run --name mean-dev -v ~/docker/data:/data --link=mongodb:mongodb -p=8000:8000 -p=9000:9000 -p=3000:3000 -p=35729:35729 -it adamarthurryan/mean-dev
|
|
3
mean-dev
Normal file
3
mean-dev
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker run -d -it --name=mean-dev --volumes-from=data-files --link=mongodb:mongodb -p=localnum:9000 -p=localnum:34729 -it adamarthurryan/mean-dev
|
44
startup
44
startup
@ -33,7 +33,7 @@ if docker inspect -f {{.Name}} mongodb
|
|||||||
echo "* creating new mongodb server"
|
echo "* creating new mongodb server"
|
||||||
# Start a mongo db server as a daemon
|
# Start a mongo db server as a daemon
|
||||||
# The server will restart automatically on boot and will use the data-db container as a volume
|
# The server will restart automatically on boot and will use the data-db container as a volume
|
||||||
docker run -p 27017 --restart=always --name=mongodb --volumes-from=data-db -d mongo
|
docker run -p 27017 --name=mongodb --volumes-from=data-db -d mongo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -51,9 +51,43 @@ if docker inspect -f {{.Name}} data-files
|
|||||||
# sudo docker run --link=mongodb:mongodb -i mongo mongo --host mongodb
|
# sudo docker run --link=mongodb:mongodb -i mongo mongo --host mongodb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
# create the samba server
|
#make sure the samba server is running
|
||||||
echo "* creating samba server"
|
if docker inspect -f {{.State.Running}} samba-server
|
||||||
sudo docker run --rm -v $(which docker):/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba data-files
|
then
|
||||||
|
echo "* samba-server running"
|
||||||
|
else
|
||||||
|
# create the samba server
|
||||||
|
echo "* creating samba server"
|
||||||
|
sudo docker run --rm -v $(which docker):/docker -v /var/run/docker.sock:/docker.sock svendowideit/samba data-files
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
# test if the mean-dev container has been created
|
||||||
|
if docker inspect -f {{.Name}} mean-dev
|
||||||
|
then
|
||||||
|
# make sure the server is running
|
||||||
|
if docker inspect -f {{.State.Running}} mean-dev
|
||||||
|
then
|
||||||
|
echo "* mean-dev exists and is running"
|
||||||
|
else
|
||||||
|
echo "* starting mean-dev"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "* creating mean-dev"
|
||||||
|
docker run -d --name=mean-dev --volumes-from=data-files --link=mongodb:mongodb -p=8000:8000 -p=9000:9000 -p=3000:3000 -p=35729:35729 -it adamarthurryan/mean-dev
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "* to attach to the mean-dev server: "
|
||||||
|
echo "> sudo docker attach mean-dev"
|
||||||
|
echo
|
||||||
|
echo "* to run an instance for access to tools:"
|
||||||
|
echo "> sudo docker run --volumes-from=data-files --rm -it adamarthurryan/mean-dev"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "* or maybe you want another dev server:"
|
||||||
|
echo "docker run -d --name=thename --volumes-from=data-files --link=mongodb:mongodb -p=localnum:9000 -p=localnum:34729 -it adamarthurryan/mean-dev"
|
||||||
|
Loading…
Reference in New Issue
Block a user