Advertisement
PashaWNN

Untitled

Sep 7th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. Dockerfile:
  2.  
  3. FROM python:3.7
  4. ENV PYTHONUNBUFFERED 1
  5. RUN mkdir /config
  6. ADD /config/requirements.txt /config/
  7. RUN pip install -r /config/requirements.txt
  8. RUN mkdir /src;
  9. WORKDIR /src
  10.  
  11.  
  12. docker-compose.yml:
  13.  
  14. version: '2'
  15. services:
  16. nginx:
  17. image: nginx:latest
  18. container_name: nginx
  19. ports:
  20. - "8000:8000"
  21. volumes:
  22. - ./src:/src
  23. - /src/static:/static
  24. - ./config/nginx:/etc/nginx/conf.d
  25. depends_on:
  26. - web
  27. web:
  28. build: .
  29. container_name: parkpass-web
  30. command: bash -c "python manage.py makemigrations && python manage.py migrate && gunicorn parkpass.wsgi -b 0.0.0.0:8000"
  31. depends_on:
  32. - parkpass-postgres
  33. - parkpass-redis
  34. environment:
  35. - PROD=1
  36. - PORT=8000
  37. - POSTGRES_DATABASE_HOST=parkpass-postgres
  38. - POSTGRES_DB_NAME=parkpass
  39. - POSTGRES_USER=parkpass
  40. - POSTGRES_PASSWORD=parkpass
  41. - USE_REDIS=1
  42. - REDIS_HOST=parkpass-redis
  43. volumes:
  44. - ./src:/src
  45. expose:
  46. - "8000"
  47.  
  48. parkpass-postgres:
  49. image: postgres:latest
  50. container_name: parkpass-postgres
  51. restart: always
  52. environment:
  53. - POSTGRES_USER=parkpass
  54. - POSTGRES_PASSWORD=parkpass
  55. - POSTGRES_DBNAME=parkpass
  56. - ALLOW_IP_RANGE=0.0.0.0/0
  57.  
  58. parkpass-redis:
  59. image: redis
  60. container_name: parkpass-redis
  61. ports:
  62. - "6379:6379"
  63. volumes:
  64. - ../data/redis:/data
  65. restart: always
  66.  
  67.  
  68. django.conf:
  69.  
  70. upstream web {
  71. ip_hash;
  72. server web:8000;
  73. }
  74.  
  75. # portal
  76. server {
  77. location /static/ {
  78. autoindex on;
  79. alias /static/;
  80. }
  81. location / {
  82. proxy_pass http://web/;
  83. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  84. proxy_set_header Host $http_host;
  85. proxy_redirect off;
  86. }
  87. listen 80;
  88. server_name localhost;
  89. }
  90.  
  91.  
  92.  
  93. requirements.txt:
  94.  
  95. Django:2.1.1
  96. Pillow:5.2.0
  97. requests:2.19.1
  98. psycopg2:2.7.5
  99. gunicorn:19.9.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement