Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dockerfile:
- FROM python:3.7
- ENV PYTHONUNBUFFERED 1
- RUN mkdir /config
- ADD /config/requirements.txt /config/
- RUN pip install -r /config/requirements.txt
- RUN mkdir /src;
- WORKDIR /src
- docker-compose.yml:
- version: '2'
- services:
- nginx:
- image: nginx:latest
- container_name: nginx
- ports:
- - "8000:8000"
- volumes:
- - ./src:/src
- - /src/static:/static
- - ./config/nginx:/etc/nginx/conf.d
- depends_on:
- - web
- web:
- build: .
- container_name: parkpass-web
- command: bash -c "python manage.py makemigrations && python manage.py migrate && gunicorn parkpass.wsgi -b 0.0.0.0:8000"
- depends_on:
- - parkpass-postgres
- - parkpass-redis
- environment:
- - PROD=1
- - PORT=8000
- - POSTGRES_DATABASE_HOST=parkpass-postgres
- - POSTGRES_DB_NAME=parkpass
- - POSTGRES_USER=parkpass
- - POSTGRES_PASSWORD=parkpass
- - USE_REDIS=1
- - REDIS_HOST=parkpass-redis
- volumes:
- - ./src:/src
- expose:
- - "8000"
- parkpass-postgres:
- image: postgres:latest
- container_name: parkpass-postgres
- restart: always
- environment:
- - POSTGRES_USER=parkpass
- - POSTGRES_PASSWORD=parkpass
- - POSTGRES_DBNAME=parkpass
- - ALLOW_IP_RANGE=0.0.0.0/0
- parkpass-redis:
- image: redis
- container_name: parkpass-redis
- ports:
- - "6379:6379"
- volumes:
- - ../data/redis:/data
- restart: always
- django.conf:
- upstream web {
- ip_hash;
- server web:8000;
- }
- # portal
- server {
- location /static/ {
- autoindex on;
- alias /static/;
- }
- location / {
- proxy_pass http://web/;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_redirect off;
- }
- listen 80;
- server_name localhost;
- }
- requirements.txt:
- Django:2.1.1
- Pillow:5.2.0
- requests:2.19.1
- psycopg2:2.7.5
- gunicorn:19.9.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement