-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (40 loc) · 1.82 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
FROM ubuntu:14.04
MAINTAINER Arsen Losenko <arsenlosenko@gmail.com>
#installation of the required packages
RUN apt-get update && apt-get install -y \
nginx \
postgresql-9.3 \
postgresql-contrib \
php5-fpm php5-pgsql \
python3 \
supervisor
#creation of document root
RUN mkdir -p /var/www/html
RUN chown -R www-data:www-data /var/www/html/ && \
chmod -R 755 /var/www/html/
RUN mkdir -p /var/log/supervisor \
&& mkdir -p /etc/supervisor/conf.d
#files reqired for nginx+php-fpm+phppgadmin
ADD nginx.conf /etc/nginx/
ADD phppgadmin /etc/nginx/sites-available/
ADD default /etc/nginx/sites-available/
ADD index.html /var/www/html
ADD phppgadmin.tar.gz /usr/share
ADD test_task/* /home/
ADD pg_hba.conf /etc/postgresql/9.3/main/
ADD start.sv.conf /etc/supervisor/conf.d/
ADD supervisord.conf /etc/supervisor/
#creation of users support and root, as well as database with its table
RUN mkdir -p /var/log/phppgadmin && touch /var/log/phppgadmin/error.log && touch /var/log/phppgadmin/access.log
RUN ln -s /usr/share/phppgadmin /var/www/html; \
ln -s /etc/nginx/sites-available/phppgadmin /etc/nginx/sites-enabled;
RUN echo listen_addresses=\'localhost\' >> /etc/postgresql/9.3/main/postgresql.conf
#opening ports for nginx and postgresql
EXPOSE 5432
EXPOSE 80
RUN service postgresql start \
&& psql -U postgres -c "create user support with superuser password 'support';" \
&& psql -U postgres -c "create database application with owner=support;" \
&& psql -U postgres application -c "create table country(id serial not null primary key, iso char(2) not null, name varchar(80) not null,nicename varchar(80) not null, iso3 char(3) default null, numcode varchar(6) default null, phonecode varchar(5) not null);" \
&& python3 /home/json_import.py
CMD supervisord -c /etc/supervisor/supervisord.conf