Guest User

Untitled

a guest
Nov 14th, 2014
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.67 KB | None | 0 0
  1. ################################################
  2. # Base image
  3. #
  4. # Installs all necessary packaging, including system
  5. # packages, user specific python/node/ruby versions, and
  6. # related packages for each (npm, pip, gem) etc.
  7. #
  8. # This reduces build time as package configuration
  9. # doesn't change often, and speeds up local development
  10. # by not requiring package installs/compiles on each restart
  11. #
  12. # This base is tailored to our specific needs, but can
  13. # easily be modified for any other project
  14. #
  15. ################################################
  16.  
  17. # Use modified ubuntu image, it contains some nice fixes
  18. # over the stock image
  19. #FROM ubuntu:14.04
  20. FROM dockerfile/ubuntu
  21.  
  22. # Let the conatiner know that there is no tty
  23. ENV DEBIAN_FRONTEND noninteractive
  24. USER root
  25.  
  26. # install system packages
  27. RUN apt-get update
  28. RUN apt-get install -y nano curl git man wget ruby nodejs python-mysqldb \
  29.   python-pip python-dev python-setuptools python-virtualenv virtualenvwrapper \
  30.   libzmq-dev imagemagick phantomjs software-properties-common
  31.  
  32. # create application user
  33. RUN useradd -m -s /bin/bash app
  34.  
  35. # install mariadb repo and client
  36. RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
  37. RUN add-apt-repository 'deb http://mirrors.coreix.net/mariadb/repo/10.0/ubuntu trusty main'
  38. RUN apt-get update
  39. RUN apt-get install -y libssl-dev mariadb-client-10.0 mysql-common libmariadbclient-dev
  40.  
  41. # install NVM
  42. USER root
  43. RUN sudo su - app -c "curl https://raw.githubusercontent.com/creationix/nvm/v0.17.3/install.sh | HOME=/home/app bash"
  44. RUN sudo su - app -c "echo 'source ~/.nvm/nvm.sh' >> /home/app/.profile"
  45. RUN sudo su - app -c "nvm install 0.10.32"
  46. RUN sudo su - app -c "echo 'nvm use 0.10.32' >> /home/app/.profile"
  47. RUN sudo su - app -c "nvm use 0.10.32"
  48.  
  49. # install RVM
  50. RUN apt-get install -y gawk libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 autoconf \
  51.   libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev
  52. RUN sudo su - app -c "gpg --keyserver keyserver.ubuntu.com --recv-keys D39DC0E3"
  53. RUN sudo su - app -c "curl -sSL https://get.rvm.io | bash -s -- stable --autolibs=read-fail"
  54. RUN sudo su - app -c "echo 'source ~/.rvm/scripts/rvm' >> /home/app/.profile"
  55. RUN sudo su - app -c "rvm install 2.1.3"
  56. RUN sudo su - app -c "echo 'rvm use 2.1.3' >> /home/app/.profile"
  57. RUN sudo su - app -c "rvm use 2.1.3"
  58. RUN sudo su - app -c "gem install sass"
  59.  
  60. # install python
  61. RUN sudo su - app -c "echo 'source /usr/share/virtualenvwrapper/virtualenvwrapper.sh' >> /home/app/.profile"
  62. RUN sudo su - app -c "mkvirtualenv app"
  63. RUN sudo su - app -c "echo 'workon app' >> /home/app/.profile"
  64.  
  65. # install logentries
  66. RUN add-apt-repository 'deb http://rep.logentries.com/ trusty main'
  67. RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 C43C79AD
  68. RUN apt-get update
  69. RUN apt-get install -y logentries logentries-daemon
  70.  
  71. # prep app env
  72. RUN sudo su - app -c "mkdir ~/frontend"
  73. RUN sudo su - app -c "mkdir ~/frontend/logs"
  74. RUN sudo su - app -c "mkdir ~/frontend/run"
  75. RUN sudo su - app -c "mkdir ~/frontend/conf"
  76.  
  77. # install node user packages, this requires some trickery due
  78. # to the way that npm works
  79. ADD frontend/frontend/static/package.json /home/app/frontend/
  80. RUN sudo su - app -c "cd ~/frontend; npm install"
  81. RUN sudo su - app -c "mv ~/frontend/node_modules/ ~/.node_modules"
  82. RUN rm -f /home/app/frontend/package.json
  83. RUN sudo su - app -c "echo 'PATH=\$PATH:\$HOME/.node_modules/.bin' >> /home/app/.profile"
  84. RUN cat /home/app/.profile
  85.  
  86. # install python packages
  87. ADD frontend/requirements.txt /home/app/frontend/
  88. RUN sudo su - app -c "pip install -r ~/frontend/requirements.txt"
  89. RUN rm -f /home/app/frontend/requirements.txt
Advertisement
Add Comment
Please, Sign In to add comment