diff --git a/Dockerfile b/Dockerfile index 63e9776..0176fef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,4 @@ RUN pip install -r requirements.txt COPY . /app/ RUN python manage.py collectstatic --no-input -CMD ["gunicorn", "clubBDM.wsgi", "--bind", "0.0.0.0:8000"] +CMD ["gunicorn", "clubBDM.wsgi", "--bind", "0.0.0.0:8001"] diff --git a/clubBDM/settings.py b/clubBDM/settings.py index 9562f5c..085d423 100644 --- a/clubBDM/settings.py +++ b/clubBDM/settings.py @@ -28,6 +28,7 @@ ALLOWED_HOSTS = [ 'localhost', '127.0.0.1', + '0.0.0.0', ] if 'SITE_URL' in os.environ: ALLOWED_HOSTS.append(os.getenv('SITE_URL')) diff --git a/docker-compose.yml b/docker-compose.yml index 08d48cb..561b25a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ services: image: mariadb:11 volumes: - database:/var/lib/mysql:rw + networks: + - database environment: - MARIADB_DATABASE=${DB_NAME} - MARIADB_USER=${DB_USER} @@ -12,32 +14,40 @@ services: app: build: . volumes: - - nginx:/app/nginx:ro - static:/app/static:rw - media:/app/media:rw + networks: + - database + - nginx environment: - DB_NAME - DB_USER - DB_PASSWORD - SECRET_KEY - SITE_URL - - DEBUG=0 + - DEBUG=${DEBUG:-0} depends_on: - db nginx: - image: nginx:1 + build: ./nginx ports: - - 8001:8000 + - 8001:8001 volumes: - - nginx:/etc/nginx/conf.d:ro - static:/app/static:ro - media:/app/media:ro + networks: + - nginx depends_on: - app +networks: + database: + driver: bridge + nginx: + driver: bridge + volumes: database: static: - media: - nginx: + media: \ No newline at end of file diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..af06251 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,3 @@ +# syntax=docker/dockerfile:1 +FROM nginx:1 +COPY default.conf /etc/nginx/conf.d \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf index 14cc8f9..6fab2f1 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -1,5 +1,5 @@ server { - listen 8000; + listen 8001; server_name bdm.insalgo.fr; location /static/ { @@ -11,7 +11,7 @@ server { } location / { - proxy_pass http://app:8000; + proxy_pass http://app:8001; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off;