forked from Uninett/nav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
101 lines (85 loc) · 3.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# NAV web development container
#
# This container aims at providing all the build- and runtime dependencies of
# NAV in a single container, and allowing for running them all directly off
# the code in your source code checkout.
#
# Run the container with your checked out NAV source code directory mounted on
# the '/source' volume to build and run all the necessary components inside
# the container. Changes to you SASS source files will be automatically
# detected and compiled, and any changes to files in the python directory will
# be immediately live in the web interface.
#
# The NAV web interface is exposed through Apache/WSGI on port 80.
# The graphite web interface is exposed through Apache/WSGI on port 8000.
#
# REQUIREMENT: For the users inside the container to be able to access the
# source code mounted at /source, the directory and its files on the host must
# be world-readable!
#
# TODO: Possibly split this into separate containers for PostgreSQL, Graphite
# and NAV.
#
FROM mbrekkevold/navbase-debian:jessie
#### Install various build and runtime requirements as Debian packages ####
RUN apt-get update \
&& apt-get -y --no-install-recommends build-dep \
python-psycopg2 \
python-lxml \
librrd-dev \
python-imaging \
python-ldap
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
mercurial \
subversion \
git-core \
librrd-dev \
autoconf \
automake \
libsnmp30 \
cron \
sudo \
apache2 \
libapache2-mod-wsgi \
rubygems \
inotify-tools \
python-cairo \
postgresql \
postgresql-contrib \
postgresql-client \
openssh-server \
vim \
less \
nbtscan
RUN pip install whisper carbon graphite-web==0.9.14 django-tagging==0.3.4 pytz ipython
RUN gem install --version '3.3.9' sass ;\
gem install --version '~> 0.9' rb-inotify
RUN adduser --system --group --no-create-home --home=/source --shell=/bin/bash nav ;\
adduser --system --group --no-create-home --home=/opt/graphite --shell=/bin/bash graphite
RUN echo "import sys\nsys.path.append('/source/python')" > /etc/python2.7/sitecustomize.py
#################################################################################
### ADDing the requirements file to pip-install Python requirements may bust ###
### Docker's cache at this point, so everything you want to keep in the cache ###
### should go before this. ###
#################################################################################
ADD tools/docker/supervisord.conf /etc/supervisor/conf.d/nav.conf
ADD requirements.txt /
ADD tests/requirements.txt /test-requirements.txt
RUN pip install -r /requirements.txt ; pip install -r /test-requirements.txt
ADD etc/graphite /opt/graphite/conf
ADD tools/docker/carbon.conf /opt/graphite/conf/
RUN cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi ;\
chown -R graphite:graphite /opt/graphite ;\
sudo -u graphite python /opt/graphite/webapp/graphite/manage.py syncdb --noinput
RUN echo "TIME_ZONE = 'Europe/Oslo'" > /opt/graphite/webapp/graphite/local_settings.py
ADD tools/docker/nav-apache-site.conf /etc/apache2/sites-available/nav-site.conf
RUN a2dissite 000-default; a2ensite nav-site
ADD tools/docker/full-nav-restore.sh /usr/local/sbin/full-nav-restore.sh
RUN echo "root:password" | chpasswd
VOLUME ["/source"]
ENV PYTHONPATH /source/python:/opt/graphite/webapp
ENV PATH /source/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
RUN echo "PATH=$PATH" > /etc/profile.d/navpath.sh
EXPOSE 22 80 8000
CMD ["/source/tools/docker/run.sh"]