-
Notifications
You must be signed in to change notification settings - Fork 214
/
Dockerfile
51 lines (41 loc) · 1.72 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
FROM ubuntu:14.04
MAINTAINER billvsme "[email protected]"
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y vim
RUN apt-get install -y nginx
RUN apt-get install -y postgresql-9.3
RUN apt-get install -y memcached
RUN apt-get install -y python-dev python-setuptools
# RUN apt-get install -y python3
# RUN apt-get install -y python3-dev python3-setuptools
RUN apt-get install -y python-pip
RUN git clone https://github.com/billvsme/vmaig_blog
WORKDIR ./vmaig_blog
RUN apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
RUN pip install -r requirements.txt
RUN apt-get install -y libpq-dev
RUN pip install psycopg2
RUN pip install gunicorn
USER postgres
RUN service postgresql start &&\
psql --command "create user vmaig with SUPERUSER password 'password';" &&\
psql --command "create database db_vmaig owner vmaig;"
USER root
RUN mkdir -p /var/log/vmaig
RUN service postgresql start &&\
sleep 10 &&\
python manage.py makemigrations --settings vmaig_blog.settings_docker &&\
python manage.py migrate --settings vmaig_blog.settings_docker &&\
echo "from vmaig_auth.models import VmaigUser; VmaigUser.objects.create_superuser('admin', '[email protected]', 'password')" | python manage.py shell --settings vmaig_blog.settings_docker &&\
echo 'yes' | python manage.py collectstatic --settings vmaig_blog.settings_docker
RUN ln -s /vmaig_blog/nginx.conf /etc/nginx/sites-enabled/vmaig
RUN rm /etc/nginx/sites-enabled/default
RUN pip install supervisor
COPY supervisord.conf /etc/supervisord.conf
RUN mkdir /var/log/supervisor
VOLUME /var/lib/postgresql/
VOLUME /var/log/vmaig/
CMD supervisord -c /etc/supervisord.conf
EXPOSE 80 443