-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
80 lines (57 loc) · 2.05 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
FROM postgres:9.6.5
MAINTAINER Phil Chin <ekkus93@gmail.com>
RUN apt-get update && apt-get upgrade -y
RUN apt-get install wget screen -y
RUN apt-get install lsb-core -y
#emacs
# update again otherwise emacs might fail to install
RUN apt-get update && apt-get upgrade -y
RUN apt-get install emacs -y --fix-missing
# python
RUN apt-get remove --auto-remove gdal-bin -y
RUN apt-get install binutils libproj-dev gdal-bin -y
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade setuptools
RUN apt-get install build-essential libssl-dev libffi-dev python3-dev
RUN pip3 install cffi
#RUN pip3 install Cython
RUN pip3 install cryptography==2.1.1
RUN pip3 install virtualenv
RUN apt-get install python3-lxml -y
RUN apt-get install python3-matplotlib -y
# postgis
RUN apt-get install postgresql-9.6-postgis-2.4 -y
# gdal
#RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable
RUN apt-get update
RUN apt-get install libpq-dev python-dev -y
RUN apt-get install gdal-bin python3-gdal -y
# xml stuff
RUN apt-get -y install libxml2-dev libxslt-dev
# text editors
RUN apt-get install vim nano -y
# home dir
RUN mkdir -p /home/postgres/scripts
RUN mkdir -p /home/postgres/work
RUN usermod -d /home/postgres postgres
# set bash shell
RUN chsh -s /bin/bash postgres
COPY ./setup_db.sh /home/postgres/scripts/setup_db.sh
COPY ./requirements.txt /home/postgres/scripts/requirements.txt
COPY ./setup_env.sh /home/postgres/scripts/setup_env.sh
RUN chown -R postgres /home/postgres
# postgres user set up
USER postgres
WORKDIR "/home/postgres/work"
# fix term
RUN echo "\nexport TERM=xterm\n" >> /home/postgres/.bashrc
# add alias for source
RUN echo "\nalias source_councilmatic='source /home/postgres/councilmatic/bin/activate'\n" >> /home/postgres/.bashrc
# set database connection
RUN echo "\nexport DATABASE_URL=postgresql:///opencivicdata\n" >> /home/postgres/.bashrc
RUN cd /home/postgres && virtualenv -p /usr/bin/python3 councilmatic
RUN bash /home/postgres/scripts/setup_env.sh
USER root
VOLUME ["/home/postgres/work"]
EXPOSE 5432 8888
COPY ./version.txt /tmp/version.txt