fix wsgi.py;
added entrypoint.sh as django entrypoint; install and use gunicorn as prod server;
This commit is contained in:
parent
065922b279
commit
560c688817
@ -1,21 +1,21 @@
|
|||||||
FROM python:3.8-slim
|
FROM python:3.8-slim
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
RUN apt-get update; \
|
||||||
|
apt-get install -y build-essential gcc; \
|
||||||
|
python -m venv /opt/venv; \
|
||||||
|
python -m pip install --upgrade pip; \
|
||||||
|
mkdir /code;
|
||||||
|
|
||||||
RUN apt-get update; \
|
WORKDIR /code
|
||||||
apt-get install -y build-essential gcc; \
|
|
||||||
python -m venv /opt/venv; \
|
|
||||||
python -m pip install --upgrade pip;
|
|
||||||
|
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
COPY setup.py /code/
|
||||||
|
COPY requirements.txt /code/
|
||||||
|
|
||||||
RUN mkdir /code
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
WORKDIR /code
|
COPY . /code/
|
||||||
|
|
||||||
COPY setup.py /code/
|
RUN chmod 777 scripts/entrypoint.sh
|
||||||
COPY requirements.txt /code/
|
ENTRYPOINT ["scripts/entrypoint.sh"]
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . /code/
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@ import os
|
|||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ app_be }}.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app_be.settings")
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|||||||
10
backend/scripts/entrypoint.sh
Normal file
10
backend/scripts/entrypoint.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# executes the manage.py commands to setup and starts the server
|
||||||
|
|
||||||
|
echo "setup"
|
||||||
|
python manage.py makemigrations
|
||||||
|
python manage.py makemigrations app_be
|
||||||
|
python manage.py migrate
|
||||||
|
|
||||||
|
echo "run server"
|
||||||
|
gunicorn app_be.wsgi:application -b 0.0.0.0 -p 8000
|
||||||
@ -21,7 +21,8 @@ setup(name='waecm-2021-group-04',
|
|||||||
'python-dotenv==0.17.1',
|
'python-dotenv==0.17.1',
|
||||||
'feedsearch==1.0.12',
|
'feedsearch==1.0.12',
|
||||||
'Pillow==8.2.0',
|
'Pillow==8.2.0',
|
||||||
'python-dateutil==2.8.1'
|
'python-dateutil==2.8.1',
|
||||||
|
'gunicorn==20.1.0'
|
||||||
],
|
],
|
||||||
license='BSD License', # example license
|
license='BSD License', # example license
|
||||||
description='DESCRIPTION')
|
description='DESCRIPTION')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user