add production image building files to scripts/production

This commit is contained in:
okalintu
2017-03-22 16:19:13 +02:00
parent 306a5b48a1
commit c35c2f0cd9
5 changed files with 120 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
# TODO https://github.com/Kazanz/docker-nginx-uwsgi-django/blob/master/Dockerfile
#FROM ubuntu:16.04
#RUN apt-get update
#Install python dependencies
#RUN apt-get install -y python3-dev python3 python3-pip python3
# install nginx
#RUN apt-get install -y nginx
# install install packet dependencies
#RUN apt-get install -y mysql-client libmysqlclient-dev libssl-dev
#RUN mkdir -p /code
#RUN mkdir -p /run
#WORKDIR /code
#ADD requirements.txt /code/
#ADD scripts/production/nginx.conf /etc/nginx/sites-enabled/default
#RUN pip3 install -r requirements.txt
#ADD . /code/
#RUN python3 manage.py collectstatic --no-input
#EXPOSE 80
#ENTRYPOINT ["/usr/bin/uwsgi", "/code/scripts/production/uwsgi.ini"]
#ENTRYPOINT ["/bin/bash"]
FROM python:3.5-alpine
RUN apk add --update \
nginx \
supervisor \
python-dev \
build-base \
linux-headers \
pcre-dev \
py-pip \
vim \
mysql-client \
mysql-dev \
openssl-dev \
libffi-dev \
jpeg-dev \
zlib-dev\
&& rm -rf /var/cache/apk/* \
&& chown -R nginx:www-data /var/lib/nginx
RUN mkdir -p /code
RUN mkdir -p /run
RUN mkdir -p /run/nginx
RUN chmod -R 777 /run
WORKDIR /code
ADD . /code/
ADD requirements.txt /code/
RUN pip install -r requirements.txt
RUN python manage.py collectstatic --no-input
RUN rm -f /etc/nginx/nginx.conf
ADD scripts/production/nginx.conf /etc/nginx/nginx.conf
RUN mkdir /etc/nginx/sites-enabled
ADD scripts/production/nginx-app.conf /etc/nginx/sites-enabled/default
RUN rm /etc/supervisord.conf
ADD scripts/production/supervisord.conf /etc/supervisord.conf
CMD ["supervisord", "-n"]
+14
View File
@@ -0,0 +1,14 @@
server{
listen 80;
server_name _;
location / {
uwsgi_pass unix:///run/django.socket;
include /etc/nginx/uwsgi_params;
}
location /static {
alias /code/static;
}
location /media {
alias /code/media;
}
}
+20
View File
@@ -0,0 +1,20 @@
#user nobody;
worker_processes 4;
error_log /dev/stdout debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
include /etc/nginx/sites-enabled/*;
default_type application/octet-stream;
keepalive_timeout 65;
sendfile on;
}
daemon off;
+17
View File
@@ -0,0 +1,17 @@
[supervisord]
[supervisorctl]
[program:app-uwsgi]
command = /usr/local/bin/uwsgi --ini /code/scripts/production/uwsgi.ini
stdout_logfile = /dev/stdout
stderr_logfile = /dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
[program:nginx-app]
command = /usr/sbin/nginx
stdout_logfile = /dev/stdout
stderr_logfile = /dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0