Browse Source

Ultima tentativa Docker Lude e Galati

Dockerlg
Lude Ribeiro 3 years ago
parent
commit
617a7c5bdd
  1. 18
      docker-compose.yml
  2. 15
      nginx.default
  3. 7
      start-server.sh

18
docker-compose.yml

@ -6,21 +6,27 @@ services:
volumes: volumes:
- ./data/db:/var/lib/postgresql/data - ./data/db:/var/lib/postgresql/data
environment: environment:
- POSTGRES_NAME=postgres - POSTGRES_NAME=sigi
- POSTGRES_USER=sigi - POSTGRES_USER=sigi
- POSTGRES_PASSWORD=123456 - POSTGRES_PASSWORD=sigi
code: - PGDATA=var/lib/postgresql/data
networks:
- sigi-net
sigi:
build: . build: .
command: python manage.py runserver 0.0.0.0:8000 command: python manage.py runserver 0.0.0.0:8000
volumes: volumes:
- .:/code - .:/code
ports: ports:
- "8000:8000" - "8001:8000"
environment: environment:
- DB_HOST=db - DB_HOST=db
- POSTGRES_NAME=postgres - POSTGRES_NAME=postgres
- POSTGRES_USER=sigi - POSTGRES_USER=sigi
- POSTGRES_PASSWORD=132456 - POSTGRES_PASSWORD=sigi
depends_on: depends_on:
- db - db
networks:
sigi-net:
name: sigi-net
driver: bridge

15
nginx.default

@ -0,0 +1,15 @@
# nginx.default
server {
listen 8020;
server_name example.org;
location / {
proxy_pass http://127.0.0.1:8010;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
root ./;
}
}

7
start-server.sh

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# start-server.sh
if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ] ; then
(.; python manage.py createsuperuser --no-input)
fi
(. ; gunicorn sigi.wsgi --user www-data --bind 0.0.0.0:8010 --workers 3) &
nginx -g "sigi off;"
Loading…
Cancel
Save