S.Çağlar Onur | 525bb72 | 2015-02-23 11:11:12 -0500 | [diff] [blame] | 1 | FROM ubuntu:14.04.2 |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 2 | MAINTAINER Andy Bavier <acb@cs.princeton.edu> |
| 3 | |
Tony Mack | 4b57218 | 2015-02-10 16:47:12 -0500 | [diff] [blame] | 4 | # XXX Workaround for docker bug: |
| 5 | # https://github.com/docker/docker/issues/6345 |
| 6 | # Kernel 3.15 breaks docker, uss the line below as a workaround |
| 7 | # until there is a fix |
| 8 | RUN ln -s -f /bin/true /usr/bin/chfn |
| 9 | # XXX End workaround |
| 10 | |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 11 | # Install. |
| 12 | RUN apt-get update |
Andy Bavier | 58be41f | 2015-02-10 16:37:33 -0500 | [diff] [blame] | 13 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git |
| 14 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql |
| 15 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-psycopg2 |
| 16 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y graphviz graphviz-dev |
| 17 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libxslt1.1 libxslt1-dev |
| 18 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip |
| 19 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tar |
| 20 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc |
| 21 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2 |
| 22 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y geoip-database libgeoip1 |
| 23 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget |
| 24 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-dev |
| 25 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libyaml-dev |
Scott Baker | 6c3b113 | 2015-04-27 17:06:51 -0700 | [diff] [blame] | 26 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config |
Scott Baker | 7b99748 | 2015-05-18 09:25:15 -0700 | [diff] [blame] | 27 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pycurl |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 28 | |
| 29 | RUN pip install django==1.7 |
| 30 | RUN pip install djangorestframework==2.4.4 |
| 31 | RUN pip install markdown # Markdown support for the browseable API. |
| 32 | RUN pip install pyyaml # YAML content-type support. |
| 33 | RUN pip install django-filter # Filtering support |
| 34 | RUN pip install lxml # XML manipulation library |
| 35 | RUN pip install netaddr # IP Addr library |
| 36 | RUN pip install pytz |
| 37 | RUN pip install django-timezones |
| 38 | RUN pip install requests |
| 39 | RUN pip install django-crispy-forms |
| 40 | RUN pip install django-geoposition |
| 41 | RUN pip install django-extensions |
| 42 | RUN pip install django-suit |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 43 | RUN pip install django-bitfield |
| 44 | RUN pip install django-ipware |
| 45 | RUN pip install django-encrypted-fields |
| 46 | RUN pip install python-keyczar |
Scott Baker | 6c3b113 | 2015-04-27 17:06:51 -0700 | [diff] [blame] | 47 | RUN pip install pygraphviz |
Scott Baker | 7b99748 | 2015-05-18 09:25:15 -0700 | [diff] [blame] | 48 | RUN pip install dnslib |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 49 | |
Andy Bavier | 58be41f | 2015-02-10 16:37:33 -0500 | [diff] [blame] | 50 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-keystoneclient |
| 51 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-novaclient |
| 52 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-neutronclient |
| 53 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-glanceclient |
| 54 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-ceilometerclient |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 55 | |
| 56 | RUN pip install django_rest_swagger |
| 57 | |
Andy Bavier | 58be41f | 2015-02-10 16:37:33 -0500 | [diff] [blame] | 58 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-setuptools |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 59 | RUN easy_install django_evolution |
| 60 | RUN easy_install python_gflags |
Andy Bavier | f6f474e | 2015-05-18 16:36:07 -0400 | [diff] [blame^] | 61 | RUN easy_install --upgrade httplib2 |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 62 | RUN easy_install google_api_python_client |
| 63 | |
Andy Bavier | 18476e4 | 2015-02-11 17:07:36 -0500 | [diff] [blame] | 64 | # Install custom Ansible |
| 65 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-crypto |
| 66 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-yaml |
| 67 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-client |
| 68 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-paramiko |
| 69 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-jinja2 |
| 70 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2 |
| 71 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible |
| 72 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras |
| 73 | RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras |
| 74 | RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core |
| 75 | RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 76 | ADD ansible-hosts /etc/ansible/hosts |
| 77 | |
| 78 | ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/ |
| 79 | |
Andy Bavier | 4373b95 | 2015-02-10 14:01:07 -0500 | [diff] [blame] | 80 | # For Observer |
| 81 | RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum |
| 82 | RUN cd /tmp/fofum; python setup.py install |
S.Çağlar Onur | 525bb72 | 2015-02-23 11:11:12 -0500 | [diff] [blame] | 83 | RUN rm -rf /tmp/fofum |
Andy Bavier | 4373b95 | 2015-02-10 14:01:07 -0500 | [diff] [blame] | 84 | |
S.Çağlar Onur | 5731184 | 2015-02-12 11:55:19 -0500 | [diff] [blame] | 85 | RUN mkdir -p /usr/local/share /bin |
| 86 | ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/ |
S.Çağlar Onur | 6093d3e | 2015-02-12 12:02:10 -0500 | [diff] [blame] | 87 | RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/ |
S.Çağlar Onur | 5731184 | 2015-02-12 11:55:19 -0500 | [diff] [blame] | 88 | RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 |
| 89 | RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs |
| 90 | RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs |
| 91 | |
Andy Bavier | 1a7245f | 2015-04-24 10:52:27 -0400 | [diff] [blame] | 92 | # Supervisor |
| 93 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor |
| 94 | ADD observer.conf /etc/supervisor/conf.d/ |
| 95 | |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 96 | # Get XOS |
Scott Baker | 7ff86d8 | 2015-02-18 22:30:22 -0800 | [diff] [blame] | 97 | ADD xos /opt/xos |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 98 | |
Scott Baker | ae14d87 | 2015-02-19 13:33:58 -0800 | [diff] [blame] | 99 | # Initscript is broken in Ubuntu |
| 100 | #ADD observer-initscript /etc/init.d/xosobserver |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 101 | |
| 102 | RUN chmod +x /opt/xos/scripts/opencloud |
| 103 | RUN /opt/xos/scripts/opencloud genkeys |
| 104 | |
Andy Bavier | da975a0 | 2015-03-13 14:01:47 -0400 | [diff] [blame] | 105 | # Workaround for AUFS issue |
| 106 | # https://github.com/docker/docker/issues/783#issuecomment-56013588 |
| 107 | RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private |
| 108 | |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 109 | # Set postgres password to match default value in settings.py |
| 110 | RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';" |
| 111 | |
| 112 | # Turn DEBUG on so that devel server will serve static files |
S.Çağlar Onur | 8bcaf6d | 2015-02-12 11:42:20 -0500 | [diff] [blame] | 113 | RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 114 | |
| 115 | # Cruft to workaround problems with migrations, should go away... |
Scott Baker | b353ffe | 2015-02-18 16:50:48 -0800 | [diff] [blame] | 116 | RUN /opt/xos/scripts/opencloud remigrate |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 117 | |
Andy Bavier | 1a7245f | 2015-04-24 10:52:27 -0400 | [diff] [blame] | 118 | # git clone uses cached copy, doesn't pick up latest |
| 119 | RUN git -C /opt/ansible pull |
Andy Bavier | 35e6ed4 | 2015-05-18 15:29:53 -0400 | [diff] [blame] | 120 | RUN git -C /opt/ansible/lib/ansible/modules/core pull |
| 121 | RUN git -C /opt/ansible/v2/ansible/modules/core pull |
Andy Bavier | 1a7245f | 2015-04-24 10:52:27 -0400 | [diff] [blame] | 122 | |
Andy Bavier | e4b346e | 2015-02-06 16:39:06 -0500 | [diff] [blame] | 123 | EXPOSE 8000 |
| 124 | |
| 125 | # Set environment variables. |
| 126 | ENV HOME /root |
| 127 | |
| 128 | # Define working directory. |
| 129 | WORKDIR /root |
| 130 | |
| 131 | # Define default command. |
Andy Bavier | bab5978 | 2015-03-13 14:52:52 -0400 | [diff] [blame] | 132 | #CMD ["/bin/bash"] |
Andy Bavier | 1a7245f | 2015-04-24 10:52:27 -0400 | [diff] [blame] | 133 | CMD service postgresql start; service supervisor start; cd /opt/xos; PUBLIC_HOSTNAME=`./xos-config.py get server_hostname $HOSTNAME`; python manage.py runserver $PUBLIC_HOSTNAME:8000 |