#2: use gunicorn with nginx as reverse proxy
This commit is contained in:
parent
754363a92e
commit
3c1fec3f63
|
|
@ -0,0 +1,4 @@
|
||||||
|
FROM nginx:1.17.4-alpine
|
||||||
|
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
upstream app_django {
|
||||||
|
server django:8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://app_django;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
django-server:
|
django:
|
||||||
build: ../../
|
build: ../../
|
||||||
ports:
|
expose:
|
||||||
- "8042:8042"
|
- 8000
|
||||||
volumes:
|
volumes:
|
||||||
- /run/mysqld/:/run/mysqld/
|
- /run/mysqld/:/run/mysqld/
|
||||||
env_file:
|
env_file:
|
||||||
- production.secrets.env
|
- production.secrets.env
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
build: ../nginx
|
||||||
|
ports:
|
||||||
|
- 8042:80
|
||||||
|
depends_on:
|
||||||
|
- django
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
FROM alpine:3.7
|
FROM alpine:3.7
|
||||||
|
|
||||||
EXPOSE 8042
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
|
|
@ -19,9 +18,7 @@ RUN apk add --virtual build-deps gcc python3-dev musl-dev && \
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# TODO #1: build a real production setup with gunicorn, nginx for static files etc.
|
EXPOSE 8000
|
||||||
#CMD ["gunicorn", "pluralityspace.wsgi:application", \
|
|
||||||
# "--bind", "0.0.0.0:8042"]
|
|
||||||
|
|
||||||
ENTRYPOINT ["python3", "./manage.py"]
|
CMD ["gunicorn", "pluralityspace.wsgi:application", \
|
||||||
CMD ["runserver", "0.0.0.0:8042"]
|
"--bind", "0.0.0.0:8000"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue