1
+ # Dockerfile for openfoodnetwork development with ubuntu 14.04, and rvm as Ruby environments manager
2
+ # Build:
3
+ # docker build -t <image_name> .
4
+ # Run:
5
+ # docker run -i -t <image_name>:latest /bin/bash --login
6
+
7
+ FROM ubuntu:14.04
8
+
9
+ # Install dependencies
10
+ RUN apt-get -y update && apt-get -y install \
11
+ git-core curl zlib1g-dev build-essential libssl-dev \
12
+ libreadline-dev libyaml-dev libsqlite3-dev sqlite3 \
13
+ libxml2-dev libxslt1-dev libcurl4-openssl-dev \
14
+ python-software-properties libffi-dev \
15
+ gawk g++ gcc make libc6-dev patch \
16
+ git postgresql-9.3 postgresql-common libpq-dev phantomjs && apt-get clean
17
+
18
+ RUN apt-get -y install pgadmin3
19
+
20
+ # # RVM Instalation
21
+
22
+ # Adding RVM Key
23
+ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
24
+
25
+ # Download
26
+ RUN curl -L https://get.rvm.io | bash -s stable
27
+
28
+ # Set ENV needed
29
+ ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+
31
+ RUN /bin/bash -l -c "rvm requirements"
32
+ RUN /bin/bash -l -c "rvm install 2.1.5"
33
+ RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
34
+
35
+ USER postgres
36
+
37
+ RUN /etc/init.d/postgresql start &&\
38
+ psql --command "CREATE USER ofn WITH SUPERUSER PASSWORD 'f00d';" &&\
39
+ createdb -O ofn open_food_network_dev
40
+
41
+ # Adjust PostgreSQL configuration so that remote connections to the
42
+ # database are possible.
43
+ RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
44
+
45
+ # And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
46
+ RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
47
+
48
+ # Expose the PostgreSQL port
49
+ EXPOSE 5432
50
+
51
+ # Add VOLUMEs to allow backup of config, logs and databases
52
+ VOLUME ["/etc/postgresql" , "/var/log/postgresql" , "/var/lib/postgresql" ]
53
+
54
+ # Set the default command to run when starting the container
55
+ CMD ["/usr/lib/postgresql/9.3/bin/postgres" , "-D" , "/var/lib/postgresql/9.3/main" , "-c" , "config_file=/etc/postgresql/9.3/main/postgresql.conf" ]
56
+
57
+ USER root
0 commit comments