No longer use insecure mode, setup external nginx server (better performances)
This commit is contained in:
parent
3f83fd6ef3
commit
a1d02ce657
12
Dockerfile
12
Dockerfile
|
@ -7,12 +7,20 @@ WORKDIR /code
|
|||
|
||||
# Install LaTeX requirements
|
||||
RUN apt update && \
|
||||
apt install -y gettext texlive-latex-extra texlive-fonts-extra texlive-lang-french && \
|
||||
apt install -y gettext texlive-latex-extra texlive-fonts-extra texlive-lang-french nginx && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY . /code/
|
||||
|
||||
# Configure nginx
|
||||
RUN ln -s nginx_tfjm.conf /etc/nginx/sites-available/tfjm.conf
|
||||
RUN rm /var/log/nginx/*.log
|
||||
RUN ln -s /dev/stdout /var/log/nginx/access.log
|
||||
RUN ln -s /dev/stderr /var/log/nginx/error.log
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
RUN ln -sf /code/nginx_tfjm.conf /etc/nginx/sites-enabled/tfjm.conf
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
ENTRYPOINT ["/code/entrypoint.sh"]
|
||||
EXPOSE 8000
|
||||
EXPOSE 80
|
||||
|
|
|
@ -4,4 +4,10 @@ python manage.py compilemessages
|
|||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
|
||||
python manage.py runserver 0.0.0.0:8000 --insecure
|
||||
service nginx start
|
||||
|
||||
if [ "$TFJM_STAGE" = "prod" ]; then
|
||||
gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread tfjm.wsgi --access-logfile '-';
|
||||
else
|
||||
./manage.py runserver 0.0.0.0:8000;
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
upstream tfjm {
|
||||
server 127.0.0.1:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name tfjm;
|
||||
|
||||
location / {
|
||||
proxy_pass http://tfjm;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /static {
|
||||
alias /code/static/;
|
||||
}
|
||||
}
|
|
@ -9,3 +9,4 @@ django-tables2
|
|||
djangorestframework
|
||||
django-rest-polymorphic
|
||||
psycopg2-binary
|
||||
gunicorn
|
Loading…
Reference in New Issue